三层交换机的应用实例
一、拓扑图
1、拓扑图
2、要求
①、PC自动连接IP,可访问内外网
二、配置接入层交换机
1、连接Trunk链路
SW1:confifgure terminal
interface f0/3
switchport mode trunk
exit
SW2:confifgure terminal
interface f0/3
switchport mode trunk
exit
SW3:confifgure terminal
interface f0/2
switchport mode trunk
exit
2、接口划分VLAN
①、在核心交换机上配置完VLAN的创建后
SW1:configure terminal
interface f0/1
switchport access vlan 10
exit
interface f0/2
switchport access vlan 20
exit
SW2:configure terminal
interface f0/1
switchport access vlan 30
exit
interface f0/2
switchport access vlan 10
exit
SW3:configure terminal
interface f0/1
switchport access vlan 40
三、配置核心交换机
1、创建Trunk
interface range f0/x-x
switchport trunk encapsulation dot1q
switchport mode trunk
exit
2、VTP创建VLAN
vtp domain MONKEY
vlan 10
exit
vlan 20
exit
vlan 30
exit
vlan 40
exit
3、启用虚拟链路
interface vlan 10
ip address 123.0.0.254 255.255.255.0
no shutdown
exit
interface vlan 20
ip address 124.0.0.254 255.255.255.0
no shutdown
exit
interface vlan 30
ip address 125.0.0.254 255.255.255.0
no shutdown
exit
interface vlan 40
ip address 126.0.0.254 255.255.255.0
no shutdown
exit
4、设置DHCP中继
configure terminal
interface vlan 10
ip helper-address 126.0.0.1
exit
interface vlan 20
ip helper-address 126.0.0.1
exit
interface vlan 30
ip helper-address 126.0.0.1
exit
5、设置外网连接
①、升级与路由连接的端口
configure terminal
interface f0/x
no switchport
exit
②、设置三层交换机路由表
configuer terminal
ip route 0.0.0.0 0.0.0.0 192.0.0.2
//ip route 网段 子网掩码 目标IP
③、设置连接外网的路由
configure terminal
ip route 123.0.0.0 255.255.255.0 192.0.0.1
ip route 124.0.0.0 255.255.255.0 192.0.0.1
ip route 125.0.0.0 255.255.255.0 192.0.0.1
ip route 126.0.0.0 255.255.255.0 192.0.0.1
ip route 203.0.0.0 255.255.255.0 202.0.0.2