我正试图在两个Ubuntu之间配置一个gre隧道:第一个带有wlan1接口192.168.1.51,第二个使用wlan2 192.168.1.2。
PC1:
ip link add gre1 type gretap remote 192.168.1.2 local 192.168.1.51
ip link set dev gre1 up
gre1@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast state
UNKNOWN mode DEFAULT group default qlen 1000
link/ether 92:d0:28:8b:3e:a6 brd ff:ff:ff:ff:ff:ff promiscuity 0
gretap remote 192.168.1.2 local 192.168.1.51 ttl inherit
PC2:
ip link add gre1 type gretap remote 192.168.1.51 local 192.168.1.2
ip link set dev gre1 up
7: gre1@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast
state UNKNOWN mode DEFAULT group default qlen 1000
link/ether ba:09:9a:66:85:02 brd ff:ff:ff:ff:ff:ff promiscuity 0
gretap remote 192.168.1.51 local 192.168.1.2 ttl inherit
但是当我从.51到.2时,我没有看到任何GRE封装。它只是经过无线局域网接口。
PC1:
10.1.0.0/16 dev eth0 proto kernel scope link src 10.1.0.51 metric 1
192.168.1.0/24 dev wlan1 proto kernel scope link src 192.168.1.51
发布于 2020-12-28 21:26:24
配置缺少隧道接口的IP地址。
PC1: 192.168.1.51 (假设隧道IP: 10.200.0.51)
ip tunnel add gre1 mode gre remote 192.168.1.2 local 192.168.1.51 ttl 255
ifconfig gre1 up
ifconfig gre1 10.200.0.51
PC2: 192.168.1.2 (隧道IP: 10.200.0.2)
ip tunnel add gre1 mode gre remote 192.168.1.51 local 192.168.1.2 ttl 255
ifconfig gre1 up
ifconfig gre1 10.200.0.2
发布于 2019-06-04 07:37:07
我知道这是个老生常谈的问题,但为了寻找其他的东西,我找到了这个,并决定回答。
长话短说,不是这样的。
更长的答案:两端都需要独立的IP :隧道端点将得到比WLAN地址更不同的IP。因此,您有192.168.1.0/24作为您的主要(物理)网络。然后您就可以使用10.0.0.0/24作为您的虚拟(GRE)网络。如果您在10.0.0.0/24子网中给gre1接口一个ip,然后进行ping,那么它们将遍历GRE链接。然后,观察wlan连接上的通信量,应该向您展示GRE封装。
https://unix.stackexchange.com/questions/404084
复制相似问题