AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题

问题[gre](server)

Martin Hope
a5hk
Asked: 2021-04-24 06:16:42 +0800 CST

使用 Open vSwitch 的 GRE 隧道

  • -2

我正在尝试使用以下设置(没有任何成功)按照此处所述实现隧道:

测试设置

ho1是仅主机接口。我想连接Nested Guest 11和Nested Guest 21。

我已经阅读了其他一些教程,例如:

https://blog.scottlowe.org/2013/05/07/using-gre-tunnels-with-open-vswitch/

http://networkstatic.net/open-vswitch-gre-tunnel-configuration/

https://costiser.ro/2016/07/07/overlay-tunneling-with-openvswitch-gre-vxlan-geneve-greoipsec/#.YIHTG9JR2Uk

但我显然错过了一些东西。我想我对这里tap使用的那些设备做错了。

更新

Guest1(网络接口)

lo               UNKNOWN        127.0.0.1/8 ::1/128
ens33            UP             192.168.41.140/24 fe80::4f54:fbff:6d87:b5a7/64
ens34            UP             192.168.239.128/24 fe80::761f:aa88:a28a:aeba/64
virbr1           DOWN           192.168.100.1/24
virbr1-nic       DOWN
virbr0           DOWN           192.168.122.1/24
virbr0-nic       DOWN
virbr2           DOWN           192.168.10.1/24
virbr2-nic       DOWN
vboxnet0         UP             192.168.56.1/24 fe80::800:27ff:fe00:0/64
ovs-system       DOWN
br0              DOWN
tap0             DOWN           10.1.1.1/8 fe80::9401:52ff:fe46:86e6/64
br1              DOWN

ovs-vsctl show(我现在已经删除了其他端口)

    Bridge br1
        Port br1
            Interface br1
                type: internal
    Bridge br0
        Port br0
            Interface br0
                type: internal
    ovs_version: "2.15.0"

根据这个我应该添加一个点击接口br0,这个命令:ovs-vsctl add-port br0 tap0。我tap0用这个命令创建:ip tuntap add mode tap tap0. 这是问题所在。我不知道应该使用哪个 IP 地址来分流,或者我什至应该为其分配一个地址?然后如何将它连接到嵌套的来宾。我为嵌套的客人使用 VirtualBox,我厌倦了连接到 VirtualBox 上的桥接适配器。在这种情况下,嵌套的访客没有获得 IP 地址。

从这里的图片中我不明白的另一件事是,br0如果我不添加eth0到外部世界(传输网络)是如何连接的br0?

更新 2

我还尝试对vboxnetX嵌套的来宾使用 hostonly 接口。在这种情况下,嵌套来宾有一个 IP 地址,但是当我添加时vboxnetX,br0我失去了来宾和嵌套来宾之间的连接。

networking virtual-machines gre openvswitch
  • 1 个回答
  • 548 Views
Martin Hope
Falcon Momot
Asked: 2021-02-13 00:45:33 +0800 CST

如何在我的 Mikrotik CCR2004 路由器和运行 Strongswan 的 Linux 主机之间设置使用 ipsec 加密的点对点 IPv6 GRE 隧道?

  • 0

为了路由目的,我需要将 IPv4 封装在 IPv6 中。一端是运行 quagga 的 Linux 机器,另一端是 Mikrotik CCR2004。如何?

mikrotik strongswan gre
  • 2 个回答
  • 1115 Views
Martin Hope
R.. GitHub STOP HELPING ICE
Asked: 2020-11-26 18:54:11 +0800 CST

读回 Linux gre[tap] 本地/远程地址

  • 3

在 Linux 上使用 iproute2,gre/gretap 接口设置ip link add为 GRE 需要remote和可选local的属性指定端点。但是,我找不到任何方法来读回这些属性。ip link show没有显示它们,并且它们似乎没有在 C 函数返回的数据结构中的任何地方表示getifaddrs(例如,如果我想实现自己的工具来获取它们)。我正在使用有大量此类接口的环境,并且我需要能够找到与特定远程地址关联的接口。有没有办法做到这一点而不将映射存储在带外的某个地方?

linux linux-networking iproute2 gre
  • 1 个回答
  • 725 Views
Martin Hope
DGB Productions
Asked: 2020-05-23 14:05:14 +0800 CST

将 Linux 流量隧道传输到 Windows

  • 0

我有两台服务器。Windows 和 Linux。假设 Linux 具有 IP 1.2.3.4 和 Windows 5.6.7.8。我希望所有流量都作为隧道转发到 Windows。如果我连接 1.2.3.4:329,我想连接 5.6.7.8:329。

好的 Linux (ubuntu) 服务器 - IP 1.2.3.4 Windows 服务器 - IP 5.6.7.8

我想通过 Linux 将所有流量推送到 Windows。通过GRE隧道等。

我希望有人知道如何做到这一点以及这是否可能?

windows linux tunneling tunnel gre
  • 1 个回答
  • 434 Views
Martin Hope
nguns
Asked: 2020-04-03 04:27:39 +0800 CST

GRE 隧道之间的 Centos7 上未转发数据包

  • 0

如图所示,我已经在 centos 机器和各个 centos 机器上的相应路由表之间配置了 GRE 隧道:

I dont have enough reputation to post images

Router1--------gre1---------Transit-Router---------gre2--------Router2

10.2.32.0/24--Router1--10.0.0.1---gre1---10.0.0.2--Transit-Router--11.0.0.2---gre2--11.0.0.1--Router2--10.4.32.0 /24

我能够从 Router-1 ping 到 gre1 隧道的另一端:

worker]# ping 10.0.0.2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=1.43 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.472 ms
64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.291 ms
64 bytes from 10.0.0.2: icmp_seq=4 ttl=64 time=0.319 ms

流量通过 GRE 隧道到达 Transit Router(由 tcpdump proto gre 验证)

从 Router-2 ping 到 gre2 隧道另一端:

worker]# ping 11.0.0.2
PING 11.0.0.2 (11.0.0.2) 56(84) bytes of data.
64 bytes from 11.0.0.2: icmp_seq=1 ttl=64 time=1.10 ms
64 bytes from 11.0.0.2: icmp_seq=2 ttl=64 time=0.392 ms
64 bytes from 11.0.0.2: icmp_seq=3 ttl=64 time=0.369 ms
64 bytes from 11.0.0.2: icmp_seq=4 ttl=64 time=0.258 ms

此流量也在隧道上流动

在中转路由器上,我可以在添加路由条目后 ping 路由器 1 和路由器 2 的私有地址: 中转路由器:

[root@vmc-centos conf]# ping 10.2.32.1
PING 10.2.32.1 (10.2.32.1) 56(84) bytes of data.
64 bytes from 10.2.32.1: icmp_seq=1 ttl=64 time=0.589 ms
64 bytes from 10.2.32.1: icmp_seq=2 ttl=64 time=0.380 ms
64 bytes from 10.2.32.1: icmp_seq=3 ttl=64 time=0.383 ms

路由器 1:

worker]# tcpdump -i any proto gre -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
04:54:36.684864 IP 10.206.83.3 > 10.206.90.103: GREv0, length 88: IP 10.0.0.2 > 10.2.32.1: ICMP echo request, id 20445, seq 34, length 64
04:54:36.684951 IP 10.206.90.103 > 10.206.83.3: GREv0, length 88: IP 10.2.32.1 > 10.0.0.2: ICMP echo reply, id 20445, seq 34, length 64
04:54:37.684776 IP 10.206.83.3 > 10.206.90.103: GREv0, length 88: IP 10.0.0.2 > 10.2.32.1: ICMP echo request, id 20445, seq 35, length 64

中转路由器:

[root@vmc-centos conf]# ping 10.4.32.1
PING 10.4.32.1 (10.4.32.1) 56(84) bytes of data.
64 bytes from 10.4.32.1: icmp_seq=1 ttl=64 time=0.553 ms
64 bytes from 10.4.32.1: icmp_seq=2 ttl=64 time=0.325 ms
64 bytes from 10.4.32.1: icmp_seq=3 ttl=64 time=0.354 ms

路由器 2:

worker]# sudo tcpdump -i any proto gre -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes
04:56:57.549823 IP 10.206.83.3 > 10.206.86.199: GREv0, length 88: IP 11.0.0.2 > 10.4.32.1: ICMP echo request, id 20690, seq 24, length 64
04:56:57.549896 IP 10.206.86.199 > 10.206.83.3: GREv0, length 88: IP 10.4.32.1 > 11.0.0.2: ICMP echo reply, id 20690, seq 24, length 64

但是现在当我尝试从路由器 1 到达路由器 2(10.4.32.1)的专用网络时,数据包到达中转路由器但没有从那里转发到路由器 2:路由器 1:

worker]# ping 10.4.32.1
PING 10.4.32.1 (10.4.32.1) 56(84) bytes of data.

中转路由器:

[root@vmc-centos conf]# tcpdump -i any proto gre -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
04:59:06.382024 IP 10.206.90.103 > 10.206.83.3: GREv0, length 88: IP 10.0.0.1 > 10.4.32.1: ICMP echo request, id 36131, seq 40, length 64
04:59:07.382007 IP 10.206.90.103 > 10.206.83.3: GREv0, length 88: IP 10.0.0.1 > 10.4.32.1: ICMP echo request, id 36131, seq 41, length 64

路由器 2:

[root@wdc-10-206-86-199 worker]# sudo tcpdump -i any proto gre -n
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 65535 bytes

在所有机器上启用路由转发:

[root@vmc-centos conf]# sudo sysctl -p
net.ipv4.ip_forward = 1

中转路由器上的 iptables:

[root@vmc-centos ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     gre  --  anywhere             anywhere            
ACCEPT     gre  --  anywhere             anywhere            

Chain FORWARD (policy DROP)
target     prot opt source               destination         
DOCKER-USER  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     gre  --  anywhere             anywhere            

Chain DOCKER (1 references)
target     prot opt source               destination         

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination         
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-USER (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere     

注意:我之前已经尝试过,数据包正在到达另一个专用网络。现在我尝试另一种设置,我缺少一些配置。

linux centos networking gre
  • 1 个回答
  • 558 Views
Martin Hope
Preston
Asked: 2020-01-31 08:40:18 +0800 CST

gretap 隧道返回流量未被处理

  • 0

我正在使用 iproute2 添加带有 vlan 标签的 GRE 第 2 层隧道,如下所示。

ip link add name gre1 type gretap local 10.0.0.2 remote 8.8.8.8
ip link add name gre1.100 link gre1 type vlan proto 802.1q id 100
ip link set gre1 up
ip link set gre1.100 up
dhclient -v gre1.100

使用 tcpdump 我看到封装的返回数据包进入“物理”接口(eth0),但不是任何一个 gre 接口。我错过了什么?

7

centos centos7 iproute2 gre
  • 1 个回答
  • 385 Views
Martin Hope
Sam Alsalem
Asked: 2017-03-12 23:00:25 +0800 CST

PPTP Passthrough Centos 7/Firewalld 路由器到 Windows Server

  • 1

我有一个运行 firewalld 的 Centos 7 服务器,以允许公共服务访问单独 VLAN(双 NIC)上的内部服务。我导入了一个 Windows 虚拟机,但除了打开 1723 之外,我不知道我需要制定哪些规则才能允许 GRE 通过防火墙。我在网上找到的所有问题和指南都不会在 Centos 7 机器上设置 PPTP,而不是将其传递给路由 IP(在本例中为 windows 服务器)。

firewall pptp centos7 firewalld gre
  • 2 个回答
  • 5239 Views
Martin Hope
anx
Asked: 2017-01-02 08:10:07 +0800 CST

为什么我会收到这么多未经请求的 GRE 数据包?

  • 1

我的(linux)服务器有一些相当简单的 iptables 规则。

iptables -A INPUT -p icmp -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport ssh -j ACCEPT
iptables -A INPUT -m tcp -p tcp --dport https -j ACCEPT
iptables -A INPUT -j LOG
iptables -A INPUT -j NFLOG
iptables -A INPUT -j DROP

ICMP 未过滤,但不允许其他不必要的连接。NFLOG 规则只是将数据包存储到数据包捕获文件 (pcap) 中。因为系统日志非常垃圾,我查看了数据包的详细信息。

tshark -V -a filesize:1 -r /scooby/doo.pcap(IP 和端口[replaced])

Frame 1: 52 bytes on wire (416 bits), 52 bytes captured (416 bits)
    Encapsulation type: Raw IP (7)
    [Protocols in frame: raw:ip:gre:ip:udp:data]
Internet Protocol Version 4, Src: [incoming IP] ([incoming IP]), Dst: [my server IP] ([my server IP])
    Version: 4
    Header length: 20 bytes
    Total Length: 52
    Identification: 0x0000 (0)
    Flags: 0x02 (Don't Fragment)
    Time to live: 52
    Protocol: GRE (47)
Generic Routing Encapsulation (IP)
    Flags and Version: 0x0000
    Protocol Type: IP (0x0800)
Internet Protocol Version 4, Src: [not my IP1] ([not my IP1]), Dst: [not my IP2] ([not my IP2])
    Version: 4
    Header length: 20 bytes
    Total Length: 28
    Time to live: 64
    Protocol: UDP (17)
User Datagram Protocol, Src Port: [random port1] ([random port1]), Dst Port: [random port2] ([random port2])
    Length: 8

主动提供的数据包主要是 ip:gre:ip:udp 数据包。GRE 数据包的数量(通常每分钟多个)大大超过了其他未经请求的数据包(漏洞扫描器/垃圾邮件发送者/端口扫描器)。GRE 封装内的所有 IP 对我来说都没有任何特殊意义,只是属于(专门)美国公司的各种常规 IP(因此,不是完全随机的地址)。

为什么有人会发送那些 GRE 数据包?

是否存在与 GRE 数据包相关的已知 DoS 漏洞?这是试图欺骗配置错误的路由器/服务器将封装的数据包转发到它们明显的目的地吗?发件人是否尝试收集有关我可能已设置的潜在 GRE 隧道性质的信息?

奖励:最合理的反应真的是“-j DROP”吗?

iptables gre
  • 1 个回答
  • 416 Views
Martin Hope
john.mill
Asked: 2016-08-29 19:44:12 +0800 CST

基于 IPSec 的 MikroTik GRE

  • 2

我正在尝试在两个 MikroTik 设备之间建立一个 GRE over IPSec 隧道。当我嗅探 WAN 接口时,一切似乎都正常工作,我可以清楚地看到理论上我不应该看到的 GRE 数据包。

我在这上面花了几天时间,我对缺少的东西一无所知。

1.1.1.1 是数据中心 WAN,而 2.2.2.2 是家庭 WAN。

路由器 1:

/interface gre
add allow-fast-path=no !keepalive local-address=1.1.1.1 name=\
    gre-tunnel-home remote-address=2.2.2.2

/ip ipsec peer
add address=2.2.2.2/32 dh-group=modp8192 enc-algorithm=blowfish \
    hash-algorithm=sha512 lifetime=30m local-address=1.1.1.1 \
    nat-traversal=no proposal-check=strict secret=secretcode

/ip ipsec policy
add dst-address=2.2.2.2/32 proposal=proposal1 sa-dst-address=2.2.2.2 \
    sa-src-address=1.1.1.1 src-address=1.1.1.1/32 tunnel=yes

路由器 2:

/interface gre
add allow-fast-path=no !keepalive local-address=2.2.2.2 name=\
    gre-tunnel-datacenter remote-address=1.1.1.1

/ip ipsec peer
add address=1.1.1.1/32 dh-group=modp8192 enc-algorithm=blowfish \
    hash-algorithm=sha512 lifetime=30m local-address=2.2.2.2 \
    nat-traversal=no proposal-check=strict secret=secretcode

/ip ipsec policy
add dst-address=1.1.1.1/32 proposal=proposal1 sa-dst-address=\
    1.1.1.1 sa-src-address=2.2.2.2 src-address=2.2.2.2/32 \
    tunnel=yes
vpn networking ipsec mikrotik gre
  • 1 个回答
  • 3593 Views
Martin Hope
Devnull
Asked: 2010-03-10 11:33:17 +0800 CST

多个 GRE NAT 路由器

  • 1

是否存在支持通过 NAT 进行多个 GRE 连接的路由器?我目前正在运行 pfSense,它一次只支持 1 个。我明白为什么,这只是一个拖累,因为这个办公室有多个人试图连接到同一个 VPN 服务器。

显然还有其他方法可以解决这个问题,例如不同的 VPN 设置、多个接口等,但出于各种原因,我更喜欢多个 GRE 连接。

vpn router gre
  • 2 个回答
  • 1326 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve