具有特定主机的两个网络之间的Netkit连接问题

时间:2015-11-14 14:42:10

标签: ping

我正在尝试使用两台路由器创建2个网络,我有10个主机,其中9个ping成功,1个没有ping(我的配置方式与其他完全相同)。这是代码,看看有人能告诉我这是什么问题。

lab.conf

C1[1]="A"
C2[1]="A"

R1[1]="A"

R2[1]="A"

LB1[0]="A"
LB1[1]="B"

LB2[0]="A"
LB2[1]="B"

S11[0]="B"
S12[0]="B"
S21[0]="B"
S22[0]="B"

C1.startup

ifconfig eth1 192.168.2.10 netmask 255.255.255.248 up
route add default gw 192.168.2.11

C2.startup

ifconfig eth1 192.168.2.13 netmask 255.255.255.248 up
route add default gw 192.168.2.14

R1.startup

/sbin/ifconfig eth1 192.168.2.9 netmask 255.255.255.248 broadcast 192.168.2.15 up

R2.startup

/sbin/ifconfig eth1 192.168.2.12 netmask 255.255.255.248 broadcast 192.168.2.15 up

LB1.startup

/sbin/ifconfig eth0 192.168.2.11 netmask 255.255.255.248 up
/sbin/ifconfig eth1 192.168.1.11 netmask 255.255.255.248 up

iptables --table nat --append PREROUTING --destination 192.168.2.11 --match statistic --mode nth --every 2 --jump DNAT --to-destination 192.168.1.10
iptables --table nat --append PREROUTING --destination 192.168.2.11 --jump DNAT --to-destination 192.168.1.9
iptables --table nat --append POSTROUTING --source 192.168.2.8/29 --destination 192.168.1.8/29 --jump MASQUERADE

echo "watch 'iptables -t nat -vnL'" >> /root/.bashrc

LB2.startup

/sbin/ifconfig eth0 192.168.2.14 netmask 255.255.255.248 up
/sbin/ifconfig eth1 192.168.1.14 netmask 255.255.255.248 up

iptables --table nat --append PREROUTING --destination 192.168.2.14 --match statistic --mode nth --every 2 --jump DNAT --to-destination 192.168.1.12
iptables --table nat --append PREROUTING --destination 192.168.2.14 --jump DNAT --to-destination 192.168.1.13
iptables --table nat --append POSTROUTING --source 192.168.2.8/29 --destination 192.168.1.8/29 --jump MASQUERADE

echo "watch 'iptables -t nat -vnL'" >> /root/.bashrc

S11.startup

ifconfig eth0 192.168.1.10 netmask 255.255.255.248 up
route add default gw 192.168.1.11
/etc/init.d/apache2 start

S12.startup

ifconfig eth0 192.168.1.9 netmask 255.255.255.248 up
route add default gw 192.168.1.11
/etc/init.d/apache2 start

S21.startup

ifconfig eth0 192.168.1.12 netmask 255.255.255.248 up
route add default gw 192.168.1.14
/etc/init.d/apache2 start

S22.startup

ifconfig eth0 192.168.1.13 netmask 255.255.255.248 up
route add default gw 192.168.1.14
/etc/init.d/apache2 start

我有问题的主持人是S22。

谢谢!

1 个答案:

答案 0 :(得分:0)

问题是最后的lab.conf没有输入或者两个,完全是idk,因为我只插入了两次,它开始识别S22 !!

相关问题