两台交换机互连,每台交换机下有两台pc(路由器做交换机添加交换模块,路由器做pc关闭路由功能) 第一台交换机下的pc1 f0/0:ip地址为192.168.10.1 vlan10,pc2 f0/0:192.168.20.1 vlan20,第二天交换机下的pc3 f0/0:ip地址为 192.168.10.2 vlan10,pc4 f0/0:192.168.20.2 vlan20 sw1 R3(config)#no ip routing R3(config)#int f0/0 R3(config-if)#ip add 192.168.10.1 255.255.255.0 R3(config-if)#no shut R3(config-if)#end R4(config)#no ip routing R4(config)#int f0/0 R4(config-if)#ip add 192.168.20.1 255.255.255.0 R4(config-if)#no shut R4(config-if)#end R5(config)#no ip routing R5(config)#int f0/0 R5(config-if)#ip add 192.168.20.2 255.255.255.0 R5(config-if)#no shut R5(config-if)#end R6(config)#no ip routing R6(config)#int f0/0 R6(config-if)#ip add 192.168.20.2 255.255.255.0 R6(config-if)#no shut R6(config-if)#end R1#vlan database R1(vlan)#vlan 10 VLAN 10 added: Name: VLAN0010 R1(vlan)#vlan 20 VLAN 20 added: Name: VLAN0020 R1(vlan)#exit R1#conf t R1(config)#int f0/0 R1(config-if)#switchport mode access R1(config-if)#switchport access vlan 10 R1(config-if)#int f0/1 R1(config-if)#switchport mode access R1(config-if)#switchport access vlan 20 R1(config-if)#end R1(config)#int f0/15 R1(config-if)#switchport trunk encapsulation dot1q R1(config-if)#switchport mode trunk R1(config-if)#end R2#vlan database R2(vlan)#vlan 10 VLAN 10 added: Name: VLAN0010 R2(vlan)#vlan 20 VLAN 20 added: Name: VLAN0020 R2(vlan)#exit R2#conf t R2(config)#int f0/0 R2(config-if)#switchport mode access R2(config-if)#switchport access vlan 10 R2(config-if)#int f0/1 R2(config-if)#switchport mode access R2(config-if)#switchport access vlan 20 R2(config-if)#end R2(config)#int f0/15 R2(config-if)#switchport trunk encapsulation dot1q R2(config-if)#switchport mode trunk R2(config-if)#end
时间: 2024-11-05 20:36:40