交换机的2和5口在VLAN 200中,1和3口在VLAN 100中,路由器配置完接口IP后,自动得到直连路由,多臂路由通过直连路由来转发不同VLAN的数据包。
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.200.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.100.1 24
[R1-GigabitEthernet0/0/1]quit
[R1]dis ip routing-table protocol direct //查看直连路由
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]vlan batch 100 200
[SW1]int e 0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 100
[SW1-Ethernet0/0/1]int e 0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 200
[SW1-Ethernet0/0/2]int e 0/0/5
[SW1-Ethernet0/0/5]port link-type access
[SW1-Ethernet0/0/5]port default vlan 200
[SW1-Ethernet0/0/5]int e0/0/3
[SW1-Ethernet0/0/3]port link-type access
[SW1-Ethernet0/0/3]port default vlan 100
[SW1-Ethernet0/0/3]dis port vlan active //验证VLAN划分情况
PC只要双击机器的图标,里面输入ip地址即可
Ping自己的网关
Ping 100的网关
Ping另一台PC,第一个丢包是在ARP请求