(2)SW3的配置
SW3#vlan database
SW3(vlan)#vlan 10
SW3(vlan)#vlan 11
SW3(vlan)#vlan 12
SW3(vlan)#vlan 8
SW3(vlan)#exit
SW3#config terminal
SW3(config)#interface fastethernet0/10
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 10
SW3(config-if)#exit
SW3(config)#interface fastethernet0/11
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 11
SW3(config-if)#exit
SW3(config)#interface fastethernet0/1
SW3(config-if)#switchport trunk encapsulation dot1Q
SW3(config-if)#switchport mode trunk
SW3(config-if)#switchport trunk allowed vlan all
SW3(config-if)#exit
SW3(config)#interface vlan 8
SW3(config-if)#ip adde
SW3(config-if)#ip address 192.168.8.130 255.255.255.128
SW3(config-if)#no shutdown
SW3(config-if)#exit
SW3(config)#ip default-gateway 192.168.8.129
SW3(config)#do show ip interface brief
Interface IP-Address OK? Method Status Prot
FastEthernet0/ unassigned YES unset up down
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/10 unassigned YES unset up up
FastEthernet0/11 unassigned YES unset up up
Vlan1 unassigned YES NVRAM up up
Vlan8 192.168.8.130 YES manual up up
SW3(config)#do show interface trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1,8,10-12
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1,8,10-12
Fa0/1 1,8,10-12
SW3(config)#do show vlan-switch brief
VLAN Name Status Ports
1 default active Fa0/0, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15
8 wg active
10 sc active Fa0/10
11 bg active Fa0/11
(3) SW4
的配置
SW4#vlan database
SW4(vlan)#vlan 8
SW4(vlan)#vlan 10
SW4(vlan)#vlan 11
SW4(vlan)#vlan 12
SW4(vlan)#exit
APPLY completed.
Exiting....
SW4#config terminal
SW4(config)#interface fastethernet0/10
SW4(config-if)#switchport mode access
SW4(config-if)#switchport access vlan 10
SW4(config-if)#exit
SW4(config)#interface fastethernet0/11
SW4(config-if)#switchport mode access
SW4(config-if)#switchport access vlan 11
SW4(config-if)#exit
SW4(config)#interface fastethernet0/1
SW4(config-if)#switchport trunk encapsulation dot1Q
SW4(config-if)#switchport mode trunk
SW4(config-if)#switchport trunk allowed vlan all
SW4(config-if)#exit
SW4(config)#interface vlan 8
SW4(config-if)#ip address 192.168.8.131 255.255.255.128
SW4(config-if)#exit
SW4(config)#ip default-gateway 192.168.8.129
SW4(config)#do show ip interface brief
Interface IP-Address OK? Method Status Pro
FastEthernet0/1 unassigned YES unset up up
FastEthernet0/10 unassigned YES unset up up
FastEthernet0/11 unassigned YES unset up up
Vlan1 unassigned YES NVRAM up up
Vlan8 192.168.8.131 YES manual up up
SW4(config)#do show interface trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/1 1-1005
Port Vlans allowed and active in management domain
Fa0/1 1,8,10-12
Port Vlans in spanning tree forwarding state and not pruned
Fa0/1 1,8,10-12
Fa0/1 1,8,10-12
SW4(config)#do show vlan-s
VLAN Name Status Ports
1 default active Fa0/0, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15
8 wg active
10 sc active Fa0/10
11 bg active Fa0/11
(4)RT5的配置
RT5(config)#interface ethernet0/0
RT5(config-if)#ip address 192.168.12.200 255.255.255.0
RT5(config-if)#no shutdown
RT5(config-if)#exit
RT5(config)#ip route 0.0.0 .0 0.0.0.0 192.168.12.1
//
全网连通性必须要配置默认表态路由
RT5(config)#do show ip interface brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.12.200 YES manual up up
Ethernet0/1 unassigned YES unset administratively down down
RT5(config)#do show ip route
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 192.168.12.1 to network 0.0.0 .0
C 192.168.12.0/24 is directly connected, Ethernet0/0
S* 0.0.0 .0/0 [1/0] via 192.168.12.1
(5)
以SW1为DHCP服务器的配置
SW1(config)#service dhcp
SW1(config)#ip dhcp pool vlan10
SW1(dhcp-config)#network 192.168.10.0 255.255.255.0
SW1(dhcp-config)#default-router 192.168.10.1
SW1(dhcp-config)#exit
SW1(config)#ip dhcp excluded-address 192.168.10.100 192.168.10.254
SW1(config)#ip dhcp pool vlan11
SW1(dhcp-config)#network 192.168.11.0 255.255.255.0
SW1(dhcp-config)#default-router 192.168.11.1
SW1(dhcp-config)#exit
SW1(config)#ip dhcp excluded-address 192.168.11.100 192.168.11.254
(6)以SW1为DHCP中继的配置
首先要删除SW1上的DHCP服务
SW1(config)#no ip dhcp pool vlan10
SW1(config)#no ip dhcp pool vlan11
SW1(config)#no ip dhcp excluded-address 192.168.11.100 192.168.11.254
SW1(config)#no ip dhcp excluded-address 192.168.10.100 192.168.10.254
再配置中继
SW1(config)#serice dhcp
SW1(config)#ip dhcp relay information option
SW1(config)#interface vlan 10
SW1(config-if)#ip helper-address 192.168.12.200
SW1(config-if)#exit
SW1(config)#interface vlan 11
SW1(config-if)#ip helper-address 192.168.12.200
SW1(config-if)#exit
然后在RT5上配置地址池等信息
RT5(config)#service dhcp
RT5 (config)#ip dhcp pool vlan10
RT5 (dhcp-config)#network 192.168.10.0 255.255.255.0
RT5 (dhcp-config)#default-router 192.168.10.1
RT5 (dhcp-config)#exit
RT5
(config)#ip dhcp excluded-address 192.168.10.1 192.168.10.150
RT5 (config)#ip dhcp pool vlan11
RT5 (dhcp-config)#network 192.168.11.0 255.255.255.0
RT5 (dhcp-config)#default-router 192.168.11.1
RT5 (dhcp-config)#exit
RT5
(config)#ip dhcp excluded-address 192.168.11.1 192.168.11.150
一、
测试结果
PC3
从DHCP中继获取的IP及连通性如下图:
此图表明从DHCP中继获取IP成功及能全网互通。
PC2
从DHCP中继获取的IP及连通性如下图:
此图表明从DHCP中继获取IP成功及能全网互通。
全网连通性测试
设备
|
SW1
|
PC1
|
PC4
|
SW3
|
SW4
|
RT5
|
192.168.10.1
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.10.100
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.11.1
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.11.100
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.12.1
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.12.100
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.8.129
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.8.130
|
√
|
√
|
√
|
√
|
√
|
√
|
192.168.8.131
|
√
|
√
|
√
|
√
|
√
|
√
|
二、
遇到的问题及思考题
第一次测试的时候发现PC1可以Ping通SW1,无法Ping通RT5,然后发现原因是在配置RT5的时候忘记配置一个静态路由,使得RT5虽然可以接收到数据,但是无法给出回复,配置了静态路由ip route0.0.0.0 0.0.0.0 192.168.12.1
思考:二层交换机的网管地址的作用
路由表,ARP表和MAC表有什么区别
思考PC1到PC2的数据流过程
什么组网情况下需要部署DHCP中继
三、
实验心得
这个三层交换与DHCP中继的实验,让我更熟练地掌握了端口的配置命令及配置情况。并且让我了解了基本的随机分配IP地址的配置命令。在过程中遇到了问题,在同学和老师的指导下,知道了如何查出问题,并认识到了对数据流进行仔细分析的重要性和必要性。
本文出自 “IT入门” 博客,谢绝转载!