交换机的配置如下:
[SW] vlan batch 10 20
[SW] interface gigabitEthernet 0/0/1
[SW-GigabitEthernet0/0/1] port link-type access
[SW-GigabitEthernet0/0/1] port default vlan 10
[SW] interface gigabitEthernet 0/0/2
[SW-GigabitEthernet0/0/2] port link-type access
[SW-GigabitEthernet0/0/2] port default vlan 20
[SW] interface Vlanif 10
[SW-vlanif10] ip address 192.168.10.254 24
[SW] interface Vlanif 20
[SW-vlanif20] ip address 192.168.20.254 24
[SW] vlan 200 #创建vlan200
[SW-vlan200] quit
[SW] interface vlanif 200
[SW-vlanif200] ip address 192.168.200.1 24
[SW-vlanif200] quit
[SW] ip route-static 0.0.0.0 0.0.0.0 192.168.200.2
配置路由器:
[Router] interface gigabitEthernet 0/0/0
[Router-GigabitEthernet0/0/0]