本文最后更新于2016-11-11,已超过 1 个月没有更新,如果文章内容或图片资源失效,请【
留言反馈】,我会及时处理,谢谢!
一、三层交换机的配置
1.启动路由功能
全局配置模式下:ip routing
关闭路由功能
全局配置模式下:no ip routing
2.配置接口路由
接口配置模式下:no switchport
二、三层交换机配置DHCP中继
让三层交换机可以将DHCP这种特殊的广播信息在VLAN间转发,让其他VLAN的客户机也可以
从DHCP服务器那里获得IP地址,需要在三层交换机上配置DHCP中继。
全局配置模式下:interface vlan vlan-id
ip helper-address DHCPsrv-IPaddress
实验一:配置三层交换实现VLAN互通与路由
三层交换机SW2的配置:
特权模式下:vlan database
vlan 2
vlan 3
全局配置模式下:ip routing
interface vlan 1
ip address 192.168.1.1 255.255.255.0
no shutdown
interface vlan 2
ip address 192.168.2.1 255.255.255.0
no shutdown
interface vlan 3
ip address 192.168.3.1 255.255.255.0
no shutdown
interface f0/1
switchport mode trunk
interface f0/2
no switchport
ip address 10.0.0.1 255.0.0.0
no shutdown
ip route 0.0.0.0 0.0.0.0 10.0.0.2
交换机SW1上的配置:
特权模式下:vlan database
vlan 2
vlan 3
全局配置模式下:interface f0/4
switchport mode trunk
interface f0/2
switchport mode access
switchport access vlan 2
interface f0/3
switchport mode access
switchport access vlan 3
路由器R1上的配置:
全局配置模式下:interface f0/0
ip address 10.0.0.2 255.0.0.0
no shutdown
interface f0/1
ip address 192.168.4.1 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 10.0.0.1
PC1配置ip地址:192.168.1.2 子网掩码:255.255.255.0 默认网关:192.168.1.1
PC2配置ip地址:192.168.2.2 子网掩码:255.255.255.0 默认网关:192.168.2.1
PC3配置ip地址:192.168.3.2 子网掩码:255.255.255.0 默认网关:192.168.3.1
PC4配置ip地址:192.168.4.2 子网掩码:255.255.255.0 默认网关:192.168.4.1
实验二:配置三层交换机DHCP中继,使PC1自动自动获取到ip地址和默认网关
DHCPsrv(R3)上的配置:
全局配置模式下:no ip routing
interface f0/0
ip address 192.168.20.2 255.255.255.0
no shutdown
ip dhcp pool p1
network 192.168.10.0 255.255.255.0
default-router 192.168.10.1
SW1上的配置:
特权模式下:vlan database
vlan 10
vlan 20
全局配置模式下:interface f0/14
switchport mode access
switchport access vlan 20
interface f0/1
switchport mode access
switchport access vlan 10
interface vlan 10
ip address 192.168.10.1 255.255.255.0
ip helper-address 192.168.20.2
no shutdown
interface vlan 20
ip address 192.168.20.1 255.255.255.0
no shutdown
interface f0/15
no switchport
ip address 192.168.0.1 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.0.2
PC1(R2)上的配置:
全局配置模式下:no ip routing
interface f0/0
ip address dhcp
no shutdown
路由器R1上的配置:
全局配置模式下:interface f0/0
ip address 192.168.0.2 255.255.255.0
no shutdown
interface f0/1
ip address 192.168.1.1 255.255.255.0
no shutdown
ip route 0.0.0.0 0.0.0.0 192.168.0.1
PC2配置ip地址:192.168.0.2 子网掩码:255.255.255.0 默认网关:192.168.0.1
您阅读这篇文章共花了: