两个VLAN中的PC有一个接口ping问题



我有一个正在运行的netkit实验室的问题。我有一台切换器和3个PCS(PC1、PC2和PC3)。PC1和PC3必须在VLAN 100上(100.1.0.x/24),PC2和PC3则必须在VLAN 200上(100.1.1.x/24)。而且我在PC3上必须只有一个接口,所以我在eth0上做了两个子接口,并给每个接口一个不同的IP。这是我的pc3.启动:

ifconfig eth0 up
vconfig add eth0 100
ifconfig eth0.100 up
vconfig add eth0 200
ifconfig eth0.200 up
ifconfig eth0 hw ether 00:00:00:00:50:00 
ifconfig eth0.200 100.1.1.5 up
ifconfig eth0.100 100.1.0.5 up

这是我的Switcher启动:

ifconfig eth0 up
ifconfig eth1 up
ifconfig eth2 up
vconfig add eth0 100
vconfig add eth0 200
ifconfig eth0.100 up
ifconfig eth0.200 up
brctl addbr vlan100
brctl addbr vlan200
brctl addif vlan100 eth2
brctl addif vlan100 eth0.100
brctl addif vlan200 eth1
brctl addif vlan200 eth0.200
ifconfig vlan100 100.1.0.0 netmask 255.255.255.0 up
ifconfig vlan200 100.1.1.0 netmask 255.255.255.0 up

eth0与pc3具有相同的冲突域。

问题是,当我想从pc3 ping pc1时,我没有问题,但当我想ping pc2时,我无法到达它。我在交换机上进行了tcpdump捕获,发现ping只在eth0.200上出现。现在,如果我更改顺序:

ifconfig eth0.200 100.1.1.5 up
ifconfig eth0.100 100.1.0.5 up

在pc3.启动时,至:

ifconfig eth0.100 100.1.0.5 up
ifconfig eth0.200 100.1.1.5 up

问题变了,我可以ping pc3,但不能ping pc1,在交换机上,请求是在eth0.100上发出的。

谢谢你,很抱歉我的英语很差。

好吧,我解决了它。:)万一有人遇到这个问题,我所做的就是在PC3启动时添加网络掩码,如下所示:

ifconfig eth0.200 100.1.1.5 netmask 255.255.255.0 up
ifconfig eth0.100 100.1.0.5 netmask 255.255.255.0 up

问候!

最新更新