三层交换

sw1(config)#int f0/0 #进接口
sw1(config-if)#ip add 12.0.0.1 255.255.255.0 #配置IP地址子网掩码网段
sw1(config-if)#no shut #开启端口

sw1(config-if)#int f1/0
sw1(config-if)#sw mo t
sw1(config-if)#sw t en dot1q
sw1(config-if)#ex
三层交换技术就是:二层交换技术+三层转发技术。它解决了局域网中网段划分之后,网段中子网必须依赖路由器进行管理的局面,解决了传统路由器低速、复杂所造成的网络瓶颈问题。

sw1(config)#vlan 10,20 #添加VLAN 10,20
sw1(config)#int vlan 10 #进VLAN10 虚拟接口
sw1(config-if)#ip add 192.168.11.1 255.255.255.0 #给VLAN10配置IP地址子网掩码
sw1(config-if)#no shut #开启虚拟端口
sw1(config-if)#int vlan 20
sw1(config-if)#ip add 192.168.12.1 255.255.255.0
sw1(config-if)#no shut
sw1(config-if)#ex
sw1(config)#do show ip int b

sw1(config)#do show ip int b #查看 端口 详细
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 12.0.0.1 YES manual up up

Vlan10 192.168.11.1 YES manual up up
Vlan20 192.168.12.1 YES manual up up

sw1(config)#vtp do abc #创一个vtp 名称为abc
sw1(config)#vtp mo ser #服务器模Server 学习,转发,添加,删除,修改
sw1(config)#vtp version 2 #配置VTP版本
sw1(config)#vtp vtp pruning #配置VTP修剪
sw1(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2 # 配置默认路由
sw1(config)#do show ip rout # 查看路由表
C 192.168.12.0/24 is directly connected, Vlan20
C 192.168.11.0/24 is directly connected, Vlan10
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 [1/0] via 12.0.0.2


sw2(config)#no ip routing
sw2(config)#vtp do abc
sw2(config)#vtp version 2
sw2(config)#vtp pruning
sw2(config)#int f1/1
sw2(config-if)#sw mo acc
sw2(config-if)#sw acc vlan 10
sw2(config-if)#int f1/2
sw2(config-if)#sw mo acc
sw2(config-if)#sw acc vlan 20
sw2(config)#do show vlan-sw d
VLAN Name Status Ports


1 default active Fa1/3, Fa1/4, Fa1/5, Fa1/6
Fa1/7, Fa1/8, Fa1/9, Fa1/10
Fa1/11, Fa1/12, Fa1/13, Fa1/14
Fa1/15
10 VLAN0010 active Fa1/1
20 VLAN0020 active Fa1/2
1002 fddi-default act/unsup
1003 trcrf-default act/unsup
1004 fddinet-default act/unsup
1005 trbrf-default act/unsup


R3(config)#int f0/1
R3(config-if)#ip add 192.168.8.1 255.255.255.0
R3(config-if)#no shut
R3(config)#int f0/0
R3(config-if)#ip add 12.0.0.2 255.255.255.0
R3(config-if)#no shut
R3(config-if)#ex
R3(config)#ip route 192.168.11.0 255.255.255.0 12.0.0.1 #实现互联互通 因为在非直连网网段上要配置目的地网段下一跳网段
R3(config)#ip route 192.168.12.0 255.255.255.0 12.0.0.1
R3(config)#do show ip rout
Codes: C - connected, S - static, 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
i - IS-IS, su - IS-IS summary, 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

S 192.168.12.0/24 [1/0] via 12.0.0.1
C 192.168.8.0/24 is directly connected, FastEthernet0/1
S 192.168.11.0/24 [1/0] via 12.0.0.1
12.0.0.0/24 is subnetted, 1 subnets
C 12.0.0.0 is directly connected, FastEthernet0/0三层交换

猜你喜欢

转载自blog.51cto.com/13660858/2113258