《dhcp加生成树加单臂路由》由会员分享,可在线阅读,更多相关《dhcp加生成树加单臂路由(9页珍藏版)》请在金锄头文库上搜索。
1、 拓扑图我们的目的是配 S1 为 VTP 的 SERVER 模式 ,S1 当 DHCP 服务器,并把 S1 做为vlan10 根交换机,并做单臂路由使 VLAN10 与 VLAN20 互通。所有交换机的端口 5-10 划分到 vlan 10 中,11-20 划分到 vlan 20 中。思科交换机默认生成树协议是开启状态。从图中可以得知 S3 为根交换机。S1S1#show spanning-treeVLAN0001Spanning tree enabled protocol ieeeRoot ID Priority 32769Address 0004.9A36.AE85 / 网桥 MAC Co
2、st 19Port 4(FastEthernet0/4)Hello Time 2 sec Max Age 20 sec Forward Delay 15 secBridge ID Priority 32769 (priority 32768 sys-id-ext 1)Address 000B.BE4E.33DC / 本交换机 MAC Hello Time 2 sec Max Age 20 sec Forward Delay 15 secAging Time 20S2S2#show spanning-tree VLAN0001Spanning tree enabled protocol ieee
3、Root ID Priority 32769Address 0004.9A36.AE85Cost 19Port 24(FastEthernet0/24)Hello Time 2 sec Max Age 20 sec Forward Delay 15 secBridge ID Priority 32769 (priority 32768 sys-id-ext 1)Address 0010.11A8.06B1Hello Time 2 sec Max Age 20 sec Forward Delay 15 secAging Time 20S3S3#show spanning-tree VLAN000
4、1Spanning tree enabled protocol ieeeRoot ID Priority 32769Address 0004.9A36.AE85This bridge is the rootHello Time 2 sec Max Age 20 sec Forward Delay 15 secBridge ID Priority 32769 (priority 32768 sys-id-ext 1)Address 0004.9A36.AE85Hello Time 2 sec Max Age 20 sec Forward Delay 15 secAging Time 20S1 配
5、置S1(config)#int range f0/1-4 / 进入多端口配置模式S1(config-if-range)#switchport mode trunk / 把端口改为 trunk 模式S1(config)#int f0/24 / 进入端口配置模式S1(config-if)# switchport mode trunk / 改为 trunk 模式S1#vlan database / 进入 VLAN 配置配置模式S1(vlan)#vtp serverS1(vlan)#vtp domain only5 / 设置域名为 only5Changing VTP domain name from
6、NULL to only5 / 已经把空域名改成 only5 。S1(vlan)#vlan 10 / 设置 VLAN10 S1(vlan)#vlan 20 / 设置 VLAN20 S1(vlan)#vtp password 123 / 设置 vtp 密码为 123S1(vlan)#exit / 退出 VLAN 配置模式APPLY completed.Exiting.S1#config t / 进入全局配置模式Enter configuration commands, one per line. End with CNTL/Z.S1(config)#int range f0/5-10 / 进入多
7、端口模式S1(config-if-range)#switchport mode access / 设置端口为 ACCESS 模式。 (思科端口默认是 ACCESS 模式)S1(config-if-range)#switchport access vlan 10 / 把端口划分到 vlan 10 S1(config-if-range)# exit / 退出S1(config)#int range f0/11-20 / 进入多端口模式S1(config-if-range)#switchport mode access / 设置端口为 ACCESS 模式。 (思科端口默认是 ACCESS 模式)S1
8、(config-if-range)#switchport access vlan 20 / 把端口划分到 vlan 20 S1(config-if-range)# exit / 退出S1(config)#spanning-tree vlan 10 root primary / 设置 VLAN10 为根网桥S1(config)#spanning-tree vlan 10 priority 4096 / 设置 vlan 10 的优先级为 4096S2 配置S2(vlan)#VTP client / 设置为客户机模式S2(vlan)#vtp domain only5 S2(vlan)#vtp pas
9、sword 123S2(config)#int range f0/5-10S2(config-if-range)#switchport mode accessS2(config-if-range)#switchport access vlan 10 S2(config)#int range f0/11-20S2(config-if-range)#switchport mode accessS2(config-if-range)#switchport access vlan 20S3 配置S3(vlan)#VTP client / 设置为客户机模式S3(vlan)#vtp domain only
10、5 S3(vlan)#vtp password 123S3(config)#int range f0/5-10S3(config-if-range)#switchport mode accessS3(config-if-range)#switchport access vlan 10 S3(config)#int range f0/11-20S3(config-if-range)#switchport mode accessS3(config-if-range)#switchport access vlan 20Only 5 配置only5(config)#int f0/0 only5(con
11、fig-if)#no shuonly5(config-if)#exitonly5(config)#ip dhcp pool vlan10 / 进入 DHCP 配置 名字为 VLAN10only5(dhcp-config)#network 192.168.1.0 255.255.255.0 / 这只网段为 192.168.1.0only5(dhcp-config)#default-router 192.168.1.1 / 网关为 192.168.1.1only5(dhcp-config)#dns-server 192.168.1.254 / DNS 为 192.168.1.254only5(dh
12、cp-config)#exitonly5(config)#ip dhcp excluded-address 192.168.1.1 192.168.1.10 / 排除自动分配地址only5(config)#ip dhcp excluded-address 192.168.1.250 192.168.1.254 only5(config)#ip dhcp pool vlan10 / 进入 DHCP 配置 名字为 VLAN10only5(dhcp-config)#network 192.168.2.0 255.255.255.0 / 这只网段为 192.168.2.0only5(dhcp-conf
13、ig)#default-router 192.168.2.1 / 网关为 192.168.2.1only5(dhcp-config)#dns-server 192.168.2.254 / DNS 为 192.168.2.254only5(dhcp-config)#exitonly5(config)#ip dhcp excluded-address 192.168.2.1 192.168.2.10 / 排除自动分配地址only5(config)#ip dhcp excluded-address 192.168.2.250 192.168.2.254 only5(config)#int f0/0.
14、1 / 进入子接口配置模式only5(config-subif)#encapsulation dot1Q 10 / 启用封装only5(config-subif)#ip address 192.168.1.1 255.255.255.0 / 设置子接口 IPonly5(config-subif)#exitonly5(config)#int f0/0.2 / 进入子接口配置模式only5(config-subif)#encapsulation dot1Q 20 / 启用封装only5(config-subif)#ip address 192.168.2.1 255.255.255.0 / 设置子
15、接口 IPonly5(config-subif)#exit全部 PC 都是 DHCP 自动获取例 PC 1 配置验证 S1 是否为 vlan 10 的根交换机S1#show spanning-tree VLAN0001Spanning tree enabled protocol ieeeRoot ID Priority 32769Address 0004.9A36.AE85Cost 19Port 4(FastEthernet0/4)Hello Time 2 sec Max Age 20 sec Forward Delay 15 secBridge ID Priority 32769 (priority 32768 sys-id-ext 1)Address 000B.BE4E.33DCHello Ti