拓扑图
配置命令
Switch
enable
vlan database
vlan 2
vlan 3
exit
conf t
int f 0/2
switchport mode access
switchport access vlan 2
exit
int f 0/3
switchport mode access
switchport access vlan 3
end
show vlan br
exit
int f 0/2
no switchport
ip add 192.168.1.254 255.255.255.0
no shutdown
exit
int f 0/3
no switchport
ip add 192.168.2.254 255.255.255.0
no shutdown
end
show running-config
// 用这个直接就可以Ping通了
int vlan 2
ip add 192.168.1.254 255.255.255.0
exit
int vlan 3
ip add 192.168.2.254 255.255.255.0
exit
ip routing
end
show ip route
Router
enable
conf t
int f 0/0
ip add 192.168.1.254 255.255.255.0
no shutdown
exit
int f 0/1
ip add 192.168.2.254 255.255.255.0
no shutdown
end
show ip route
实验结果
Switch
Router
Ping