文章目录
实验拓扑

实验要求
- 天津的网络由DHCP-Server1分配IP
- 北京的网络由路由器分配IP
- 需要做以太网通道
- 上海的网关设备三层交换机,上海的DHCP中服务器做中继
- 实现全网互通
- 交换机和路由器都可以实现内网管理
实验步骤
0x01 DHCP-Server1配置
-
打开DHCP-Server配置界面,点击【Desktop】选项卡中的【IP Configuration】图标,在IP Configuration界面设置IP信息,操作结果如下图所示。
-
点击【Services】选项卡关闭其他默认开启的服务,保留并设置DHCP服务,操作结果如下图所示。
-
将PC1的IP地址获取设置为DHCP方式,PC1通过DHCP获取DHCP-Server1中serverPool地址池中的地址
192.168.30.10
,操作结果如下图所示。
0x02 tj-sw1配置
-
打开tj-sw1交换机的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit hostname tj-sw1
-
使用如下命令配置tj-sw1的VLAN信息并在
f0/4-6
接口配置以太链路,操作结果如下图所示。vlan 100 vlan 10 vlan 20 exit int f0/1 switchport mode access switchport access vlan 100 int f0/2 switchport mode access switchport access vlan 10 int f0/3 switchport mode trunk switchport trunk allowed vlan all int range f0/4-6 switchport mode trunk switchport trunk allowed vlan all channel-group 1 mode on ex
-
使用如下命令开启并配置tj-sw1交换机的远程管理功能,操作结果如下图所示。
ex line vty 0 4 pass cisco login exit enable pass cisco int vlan 10 ip add 192.168.10.2 255.255.255.0 no sh ex ip default-gateway 192.168.10.1
0x03 tj-sw2配置
-
打开tj-sw2交换机的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname tj-sw2
-
使用如下命令配置tj-sw2的VLAN信息并在
f0/4-6
接口配置以太链路,操作结果如下图所示。vlan 10 vlan 20 exit int f0/1 switchport mode access switchport access vlan 20 int f0/2 switchport mode access switchport access vlan 10 int range f0/4-6 switchport mode trunk switchport trunk allowed vlan all channel-group 1 mode on
-
使用如下命令开启并配置tj-sw2交换机的远程管理功能,操作结果如下图所示。
ex line vty 0 4 pass cisco login exit enable pass cisco int vlan 10 ip add 192.168.10.3 255.255.255.0 no sh ex ip default-gateway 192.168.10.1
0x04 tj-R配置
-
打开tj-R路由器的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname tj-R
-
使用如下命令配置tj-R路由器串口的IP地址、速率等信息,操作结果如下图所示。
int s1/0 ip add 223.221.159.1 255.255.255.0 clock rate 9600 no sh
-
使用单臂路由(如下)实现tj地区各VLAN之间的数据传输,操作结果如下图所示。
int f0/0.1 encapsulation dot1Q 100 ip add 192.168.30.1 255.255.255.0 no sh ip helper-address 192.168.30.254 int f0/0.2 encapsulation dot1Q 10 ip add 192.168.10.1 255.255.255.0 no sh ip helper-address 192.168.30.254 int f0/0.3 encapsulation dot1Q 20 ip add 192.168.20.1 255.255.255.0 no sh ip helper-address 192.168.30.254 int f0/0 no sh
-
使用如下命令配置tj-R的路由,操作结果如下图所示。
ex router rip version 2 network 192.168.10.0 network 192.168.20.0 network 192.168.30.0 network 223.221.159.0
-
使用如下命令开启并配置tj-R路由器的远程管理,操作结果如下图所示。
ex line vty 0 4 pass cisco login exit enable pass cisco
0x05 ISP-A配置
-
打开tj-R路由器的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname ISP-B
-
使用如下命令配置ISP-A路由器的接口地址,操作结果如下图所示。
int f0/0 ip add 111.111.111.1 255.255.255.0 no sh int s1/0 ip add 223.221.159.2 255.255.255.0 no sh int s1/1 ip add 223.11.115.1 255.255.255.0 clock rate 9600 no sh
-
使用如下命令配置路由,操作结果如下图所示。
router rip version 2 network 111.111.111.0 network 223.11.115.0 network 223.221.159.0
0x06 ISP-sw配置
0x07 Web-Server配置
-
打开Web-Server配置界面,点击【Desktop】选项卡中的【IP Configuration】图标,在IP Configuration界面设置IP信息,操作结果如下图所示。
-
点击【Services】选项卡关闭其他默认开启的服务,保留并设置HTTP服务,操作结果如下图所示。
0x08 DNS-Server配置
-
打开DNS-Server配置界面,点击【Desktop】选项卡中的【IP Configuration】图标,在IP Configuration界面设置IP信息,操作结果如下图所示。
-
点击【Services】选项卡关闭其他默认开启的服务,保留并设置DNS服务,操作结果如下图所示。
0x09 bj-R配置
-
打开bj-R路由器的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname bj-R
-
使用如下命令配置bj-R路由器串口的IP地址等信息,操作结果如下图所示。
int s1/0 ip add 223.11.115.2 255.255.255.0 no sh int f0/1 ip add 223.22.115.1 255.255.255.0 no sh
-
使用单臂路由(如下)实现bj地区各VLAN之间的数据传输,操作结果如下图所示。
int f0/0.1 encapsulation dot1Q 100 ip add 192.168.100.1 255.255.255.0 no sh int f0/0.2 encapsulation dot1Q 200 ip add 192.168.101.1 255.255.255.0 no sh int f0/0 no sh
-
使用如下命令配置bj-R的DHCP服务,操作结果如下图所示。
ip dhcp pool vlan100 network 192.168.100.0 255.255.255.0 default-router 192.168.100.1 dns-server 111.111.111.254 ex ip dhcp excluded-address 192.168.100.1 192.168.100.10 ip dhcp pool vlan200 network 192.168.101.0 255.255.255.0 default-router 192.168.101.1 dns-server 111.111.111.254 ex ip dhcp excluded-address 192.168.101.1 192.168.101.10
-
使用如下命令配置bj-R的路由,操作结果如下图所示。
router rip version 2 network 192.168.100.0 network 192.168.101.0 network 223.11.115.0 network 223.22.115.0
-
使用如下命令开启并配置bj-R路由器的远程管理,操作结果如下图所示。
ex line vty 0 4 pass cisco login exit enable pass cisco
0x10 bj-sw配置
-
打开bj-sw交换机的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging synchronous exit hostname bj-sw
-
使用如下命令配置bj-sw的VLAN信息,操作结果如下图所示。
vlan 100 vlan 200 exit int f0/1 switchport mode access switchport access vlan 100 int f0/2 switchport mode access switchport access vlan 200 int f0/3 switchport mode trunk switchport trunk allowed vlan all ex
-
使用如下命令开启并配置bj-sw交换机的远程管理功能,操作结果如下图所示。
line vty 0 4 pass cisco login exit enable pass cisco int vlan 100 ip add 192.168.100.2 255.255.255.0 no sh ex ip default-gateway 192.168.100.1
0x11 sh-sw1配置
-
打开sh-sw1交换机的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname sh-sw1
-
使用如下命令配置sh-sw1的VLAN信息,操作结果如下图所示。
vlan 100 vlan 200 exit int vlan 100 ip address 192.168.200.1 255.255.255.0 ip helper-address 192.168.201.254 no sh int vlan 200 ip add 192.168.201.1 255.255.255.0 ip helper-address 192.168.201.254 no sh int f0/1 switchport trunk encapsulation dot1q switchport mode trunk switchport trunk allowed vlan all
-
使用如下命令配置三层交换机接口,操作结果如下图所示。
exit ip routing int f0/2 no switchport ip add 223.22.115.2 255.255.255.0 no sh
-
使用如下命令配置路由,操作结果如下图所示。
route rip version 2 network 223.22.115.0 network 192.168.200.0 network 192.168.201.0
-
使用如下命令开启并配置sh-sw1交换机的远程管理功能,操作结果如下图所示。
line vty 0 4 pass cisco login exit enable pass cisco
0x12 sh-sw2配置
-
打开sh-sw2交换机的【CLI】选项卡中使用如下命令配置一下设备的基础环境,操作结果如下图所示。
en conf t no ip domain-lookup line console 0 exec-timeout 0 0 logging syn exit hostname sh-sw2
-
使用如下命令配置sh-sw2的VLAN信息,操作结果如下图所示。
vlan 100 vlan 200 exit int f0/1 switchport mode access switchport access vlan 100 int f0/2 switchport mode access switchport access vlan 200 int f0/3 switchport mode trunk switchport trunk allowed vlan all
-
使用如下命令开启并配置sh-sw2交换机的远程管理功能,操作结果如下图所示。
line vty 0 4 pass cisco login exit enable pass cisco int vlan 100 ip add 192.168.200.3 255.255.255.0 no sh ex ip default-gateway 192.168.200.1
0x13 DHCP-Server2配置
-
打开DHCP-Server2配置界面,点击【Desktop】选项卡中的【IP Configuration】图标,在IP Configuration界面设置IP信息,操作结果如下图所示。
-
点击【Services】选项卡关闭其他默认开启的服务,保留并设置DHCP服务,操作结果如下图所示。
实验结果
-
PC1设置DHCP后从DHCP-Server1中获取IP地址,显示结果如下图所示。
-
PC4设置DHCP后从bj-R路由器获取IP地址,显示结果如下图所示。
-
PC6设置DHCP后从DHCP-Server2获取IP地址,显示结果如下图所示。
-
PC2可以访问
www.baidu.com
,显示结果如下图所示。 -
PC5远程管理bj-sw交换机,操作结果如下图所示。
-
PC5远程管理bj-R路由器,操作结果如下图所示。
实验总结
- 与单臂路由相连的交换机上需要配置局域网内使用到的所有VLAN
- 三层交换机默认做二层交换机使用,若想使用三层功能需要使用
ip routing
命令开启。 - 三层交换机的接口模式工作在二层,做三层接口时需要先使用
no switchport
命令转一下。 - 二层交换机默认封装了
dot1q
协议,但三层交换机默认不封装,使用时需要手动封装。