拓扑图
配置命令
Switch0
enable
vlan database
vlan 2
vlan 3
vlan 6
exit
conf t
hostname S1
int range f0/1-2
switchport mode access
switchport access vlan 2
exit
int range f0/3-4
switchport mode access
switchport access vlan 3
exit
int f0/5
switchport mode access
switchport access vlan 6
end
show vlan
conf t
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
int vlan 6
ip add 192.168.5.1 255.255.255.0
exit
ip routing
router rip
network 192.168.1.0
network 192.168.2.0
network 192.168.5.0
end
show ip route
Switch1
enable
vlan database
vlan 2
vlan 3
vlan 6
exit
conf t
hostname S2
int range f0/1-2
switchport mode access
switchport access vlan 4
exit
int range f0/3-4
switchport mode access
switchport access vlan 5
exit
int f0/5
switchport mode access
switchport access vlan 6
end
show vlan
conf t
int vlan 4
ip add 192.168.3.254 255.255.255.0
exit
int vlan 5
ip add 192.168.4.254 255.255.255.0
exit
int vlan 6
ip add 192.168.5.2 255.255.255.0
exit
ip routing
router rip
network 192.168.3.0
network 192.168.4.0
network 192.168.5.0
end
show ip route
实验结果
Switch0
Switch1
Ping