iptunnle (ipip)

来源:互联网 发布:婚纱网络客服干什么的 编辑:程序博客网 时间:2024/06/10 12:00

ip tunnel连接Linux主机对Linux主机VPN

 

主机A外网IP 123.45.67.8 内网: IP:10.0.0.1
主机B外网IP 8.76.54.32 内网: IP:10.0.0.2

A主机执行
modprobe ipip
modprobe ip_gre
ip tunnel add ipip mode gre remote 8.76.54.32 local 123.45.67.8
ip link set ipip up
ip addr add 10.0.0.1/30 dev ipip
ifconfig ipip 10.0.0.1 pointopoint 10.0.0.2

B主机执行
modprobe ipip
modprobe ip_gre
ip tunnel add ipip mode gre remote 123.45.67.8 local 8.76.54.32
ip link set ipip up
ip addr add 10.0.0.2/30 dev ipip
ifconfig ipip 10.0.0.2 pointopoint 10.0.0.1