Linux隧道配置
Server1:
Eth0:192.168.100.90 tunl1 172.16.100.90
Server2:
Eth0:192.168.100.100 tunl1 172.16.100.100
Server1 server2之间eth0同网段直连,但是tunl1之间无法互访
通过配置gre隧道使tunl1之间互相连接
Server1:
modeprobe ipip
modprobe ip_gre
iptunnel add tunl1 mode gre remote 192.168.100.100 local 192.168.100.90 dev eth0
ip link set tunl1 up
ip addr add 172.16.100.90 peer 172.16.100.100 dev tunl1
ip route add 172.16.100.0/24 dev tunl
Server2:
modeprobe ipip
modprobe ip_gre
iptunnel add tunl1 mode gre remote 192.168.100.90 local 192.168.100.100 dev eth0
ip link set tunl1 up
ip addr add 172.16.100.100 peer 172.16.100.90 dev tunl1
ip route add 172.16.100.0/24 dev tunl1
iptables -F
Ip 隧道
Server1:
modeprobe ipip
iptunnel add tunl1 mode ipip remote 192.168.100.100 local 192.168.100.90
ifconfig tunl1 172.16.100.90 netmask 255.255.255.255
route add -host 172.16.100.100 dev tunl1
Server2:
modeprobe ipip
iptunnel add tunl1 mode ipip remote 192.168.100.90 local 192.168.100.100
ifconfig tunl1 172.16.100.100 netmask 255.255.255.255
ip route add 172.16.100.90 dev tunl1
Server1:
Eth0:192.168.100.90 tunl1 172.16.100.90
Server2:
Eth0:192.168.100.100 tunl1 172.16.100.100
Server1 server2之间eth0同网段直连,但是tunl1之间无法互访
通过配置gre隧道使tunl1之间互相连接
Server1:
modeprobe ipip
modprobe ip_gre
iptunnel add tunl1 mode gre remote 192.168.100.100 local 192.168.100.90 dev eth0
ip link set tunl1 up
ip addr add 172.16.100.90 peer 172.16.100.100 dev tunl1
ip route add 172.16.100.0/24 dev tunl
Server2:
modeprobe ipip
modprobe ip_gre
iptunnel add tunl1 mode gre remote 192.168.100.90 local 192.168.100.100 dev eth0
ip link set tunl1 up
ip addr add 172.16.100.100 peer 172.16.100.90 dev tunl1
ip route add 172.16.100.0/24 dev tunl1
iptables -F
Ip 隧道
Server1:
modeprobe ipip
iptunnel add tunl1 mode ipip remote 192.168.100.100 local 192.168.100.90
ifconfig tunl1 172.16.100.90 netmask 255.255.255.255
route add -host 172.16.100.100 dev tunl1
Server2:
modeprobe ipip
iptunnel add tunl1 mode ipip remote 192.168.100.90 local 192.168.100.100
ifconfig tunl1 172.16.100.100 netmask 255.255.255.255
ip route add 172.16.100.90 dev tunl1
本文介绍如何在两台Linux服务器之间配置GRE隧道,实现不同网段间网络设备的互联互通。具体步骤包括加载内核模块、创建隧道接口、设置IP地址及路由等。
2329

被折叠的 条评论
为什么被折叠?



