2011-04-03 20:05:34| 分类: Linux Cluster | 标签: |举报 |字号大中小 订阅
设为ipa和ipb,eth1未使用,也未配置ip地址
在a上
insmod ipip//加载ipip隧道模块
ip tunnel add abc mode ipip remote ipb//添加一个隧道,名字为abc,类型为ipip,对端地
址为ipb
ifconfig abc 10.1.0.1 netmask 255.255.255.0 broadcast 10.1.0.255//为abc配置ip地址
ifconfig eth1 10.1.1.1 netmask 255.255.255.0 broadcast 10.1.1.255//配置eth1
route add -net 10.1.2.0/24 dev abc//增加路由,到10.1.2.0的包全部到隧道abc
iptables -I INPUT -p 4 -j ACCEPT//允许ipip包
iptables -I INPUT -p icmp -j ACCEPT//允许icmp
在b上
insmod ipip//加载ipip隧道模块
ip tunnel add abc mode ipip remote ipa//添加一个隧道,名字为abc,类型为ipip,对端地
址为ipa
ifconfig abc 10.1.0.1 netmask 255.255.255.0 broadcast 10.1.0.255//为abc配置ip地址
ifconfig eth1 10.1.2.1 netmask 255.255.255.0 broadcast 10.1.2.255//配置eth1
route add -net 10.1.1.0/24 dev abc//增加路由,到10.1.1.0的包全部到隧道abc
iptables -I INPUT -p 4 -j ACCEPT//允许ipip包
iptables -I INPUT -p icmp -j ACCEPT//允许icmp
现在在a上ping -I 10.1.1.1 10.1.2.1和在b上ping -I 10.1.2.1 10.1.1.1都可以了
如果a和b的eth1都接入内网,那么这两个网段都可以互相访问了
评论