本文主要是介绍Linux隧道sit,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
Linux隧道sit(Simple Internet Transition),配置环境如下:
|----------| |----------|| | ens33 ens33 | || Client |--------------------------------| Server || | 192.168.20.5 192.168.20.1 | ||----------| |----------|
Server主机配置
# ip address add 192.168.20.5/24 dev ens33
#
# ip tunnel add sit1 mode sit remote 192.168.20.5
# ip link set sit1 up
# ip addr add 3ffe::1/64 dev sit1
配置一个虚拟网桥接口,验证使用。
# ip link add dev br0 type bridge
# ip link set br0 up
# ip addr add 3000::1/64 dev br0
查看接口地址和隧道配置:
# ip addr show
15: sit1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN group default qlen 1000link/sit 0.0.0.0 peer 192.168.20.5inet6 3ffe::1/64 scope global valid_lft forever preferred_lft foreverinet6 fe80::c0a8:1401/64 scope link valid_lft forever preferred_lft forever
# ip tunnel show
sit1: ipv6/ip remote 192.168.20.5 local any ttl inherit 6rd-prefix 2002::/16
Client主机
# ip address add 192.168.20.1/24 dev ens33
#
# ip tunnel add sit1 mode sit remote 192.168.20.1 local 192.168.20.5
# ip link set sit1 up
# ip address add dev sit1 3ffe::5# ip route add ::/0 dev sit1
查看接口地址和隧道配置:
# ip addr show
12: sit1@NONE: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN group default qlen 1000link/sit 192.168.20.5 peer 192.168.20.1inet6 3ffe::5/128 scope global valid_lft forever preferred_lft foreverinet6 fe80::c0a8:1405/64 scope link valid_lft forever preferred_lft forever
# ip tunnel show
sit1: ipv6/ip remote 192.168.20.1 local 192.168.20.5 ttl inherit 6rd-prefix 2002::/16
验证
在Client主机192.168.20.5上验证隧道联通性:
$ ping 3ffe::1 -c 1
PING 3ffe::1(3ffe::1) 56 data bytes
64 bytes from 3ffe::1: icmp_seq=1 ttl=64 time=0.265 ms--- 3ffe::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.265/0.265/0.265/0.000 ms
$
$
$ ping 3000::1 -c 1
PING 3000::1(3000::1) 56 data bytes
64 bytes from 3000::1: icmp_seq=1 ttl=64 time=0.281 ms--- 3000::1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.281/0.281/0.281/0.000 ms
SIT报文
如下ICMP Echo请求报文,IPv4头部的协议字段为41,即封装了IPv6报文:
这篇关于Linux隧道sit的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!