Cisco三层交换机不同vlan不同网段间相互通信

Cisco三层交换机不同vlan不同网段间相互通信_第1张图片

Switch1:

Switch(config)#vlan 10
Switch(config-vlan)#e
Switch(config)#int fa0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#int fa0/2
Switch(config-if)#switchport access vlan 10

Switch0:

Switch>en
Switch#conf t
Switch(config)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#e
Switch(config)#int fa0/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#int fa0/2
Switch(config-if)#switchport access vlan 20
Switch(config-if)#int fa0/3
Switch(config-if)#switchport access vlan 30

三层交换机:

Switch>en
Switch#conf t
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#e
Switch(config)#int vlan 10
Switch(config-if)#ip add 192.168.11.1 255.255.255.0   //vlan的IP与所对应的主机网关一致
Switch(config-if)#int vlan 20
Switch(config-if)#ip add 192.168.12.1 255.255.255.0
Switch(config-if)#int vlan 30
Switch(config-if)#ip add 192.168.13.1 255.255.255.0
Switch(config-if)#e
Switch(config)#ip routing
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.11.0/24 is directly connected, Vlan10
C 192.168.12.0/24 is directly connected, Vlan20
C 192.168.13.0/24 is directly connected, Vlan30
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#int fa0/3
Switch(config-if)#no switchport 
Switch(config-if)#ip add 192.168.14.1 255.255.255.0

Switch#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.11.0/24 is directly connected, Vlan10
C 192.168.12.0/24 is directly connected, Vlan20
C 192.168.13.0/24 is directly connected, Vlan30
C 192.168.14.0/24 is directly connected, FastEthernet0/3

路由表前的C表示为直连路由

你可能感兴趣的:(Cisco,网络)