TLDR
隧道协议 | 无 | IpIp | IpSit | UDP |
---|---|---|---|---|
带宽(MB/s) | 1305 | 1288 | 1289 | 1259 |
在一种工作负载下,进行简单测试,IpIp与IpSit性能相当,UDP稍差。
测试服务器信息
测试Server服务器:172.31.183.57
测试Client服务器:172.31.183.58
网络掩码:255.255.240.0
无隧道
# server
iperf3 -s -f K
# client
iperf3 -c $IP -f M
server侧观测
client侧观测
ipip隧道
# 开启ipip隧道
modprobe ipip
# server
ip tunnel add ipip_tunnel mode ipip local 172.31.183.57 remote 172.31.183.58 ttl 32
ip link set ipip_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.ipip_tunnel.rp_filter=0
ip addr add 172.31.183.59/32 dev ipip_tunnel
ip route add 172.31.183.60 dev ipip_tunnel
# client
ip tunnel add ipip_tunnel mode ipip local 172.31.183.58 remote 172.31.183.57 ttl 32
ip link set ipip_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.ipip_tunnel.rp_filter=0
ip addr add 172.31.183.60/32 dev ipip_tunnel
ip route add 172.31.183.59 dev ipip_tunnel
clean
# server
ip route del 172.31.183.60 dev ipip_tunnel
ip addr del 172.31.183.59/32 dev ipip_tunnel
ip link del ipip_tunnel
# client
ip route del 172.31.183.59 dev ipip_tunnel
ip addr del 172.31.183.60/32 dev ipip_tunnel
ip link del ipip_tunnel
server侧观测
[图片上传失败...(image-1b31e8-1636362323224)]
client侧观测
ipSet隧道
# server
ip link add name sit_tunnel type sit local 172.31.183.57 remote 172.31.183.58 mode any
ip link set sit_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.sit_tunnel.rp_filter=0
ip addr add 172.31.183.59/32 dev sit_tunnel
ip route add 172.31.183.60 dev sit_tunnel
# client
ip link add name sit_tunnel type sit local 172.31.183.58 remote 172.31.183.57 mode any
ip link set sit_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.sit_tunnel.rp_filter=0
ip addr add 172.31.183.60/32 dev sit_tunnel
ip route add 172.31.183.59 dev sit_tunnel
clean
# server
ip route del 172.31.183.60 dev sit_tunnel
ip addr del 172.31.183.59/32 dev sit_tunnel
ip link del sit_tunnel
# client
ip route del 172.31.183.59 dev sit_tunnel
ip addr del 172.31.183.60/32 dev sit_tunnel
ip link del sit_tunnel
server侧观测
[图片上传失败...(image-ba0d03-1636362323224)]
client侧观测
UDP隧道
# server
ip link add vxlan_tunnel type vxlan id 42 dstport 4789 local 172.31.183.57 remote 172.31.183.58 dev eth0
ip link set vxlan_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.vxlan_tunnel.rp_filter=0
ip addr add 172.31.183.59/32 dev vxlan_tunnel
ip route add 172.31.183.60 dev vxlan_tunnel
# client
ip link add vxlan_tunnel type vxlan id 42 dstport 4789 local 172.31.183.58 remote 172.31.183.57 dev eth0
ip link set vxlan_tunnel up
sysctl -w net.ipv4.conf.all.rp_filter=0
sysctl -w net.ipv4.conf.vxlan_tunnel.rp_filter=0
ip addr add 172.31.183.60/32 dev vxlan_tunnel
ip route add 172.31.183.59 dev vxlan_tunnel
clean
# server
ip route del 172.31.183.60 dev vxlan_tunnel
ip addr del 172.31.183.59/32 dev vxlan_tunnel
ip link del vxlan_tunnel
# client
ip route del 172.31.183.59 dev vxlan_tunnel
ip addr del 172.31.183.60/32 dev vxlan_tunnel
ip link del vxlan_tunnel
server侧观测
[图片上传失败...(image-410f77-1636362323224)]