赞
踩
SW1
[SW1]vlan 10
[SW1-vlan10]vlan 20
[SW1-vlan20]vlan 30
[SW1-vlan30]vlan 40
[SW1-vlan40]qu
[SW1]int vlan 10
[SW1-Vlan-interface10]ip add 192.168.10.1 24
[SW1-Vlan-interface10]int vlan 20
[SW1-Vlan-interface20]ip add 192.168.20.1 24
[SW1-Vlan-interface20]int vlan 30
[SW1-Vlan-interface30]ip add 192.168.30.1 24
[SW1-Vlan-interface30]int vlan 40
[SW1-Vlan-interface40]ip add 192.168.40.1 24
SW2
[SW2]vlan 10
[SW2-vlan10]vlan 20
[SW2-vlan20]vlan 30
[SW2-vlan30]vlan 40
[SW2-vlan40]qu
[SW2]int vlan 10
[SW2-Vlan-interface10]ip add 192.168.10.2 24
[SW2-Vlan-interface10]int vlan 20
[SW2-Vlan-interface20]ip add 192.168.20.2 24
[SW2-Vlan-interface20]int vlan 30
[SW2-Vlan-interface30]ip add 192.168.30.2 24
[SW2-Vlan-interface30]int vlan 40
[SW2-Vlan-interface40]ip add 192.168.40.2 24
SWA
[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 10
[H3C-vlan10]port GigabitEthernet 1/0/5
SWB
[SW4]vlan 10
[SW4]vlan 20
[SW4-vlan20]vlan 30
[SW4-vlan30]vlan 40
[SW4-vlan40]qu
[SW4]vlan 20
[SW4-vlan20]port GigabitEthernet 1/0/5
SWC
[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 30
[H3C-vlan30]port GigabitEthernet 1/0/5
SWD
[H3C]vlan 10
[H3C-vlan10]vlan 20
[H3C-vlan20]vlan 30
[H3C-vlan30]vlan 40
[H3C-vlan40]qu
[H3C]vlan 40
[H3C-vlan40]port GigabitEthernet 1/0/5
SW1
[SW1]int range FortyGigE 1/0/53 to FortyGigE 1/0/54
[SW1-if-range]port link-type trunk
[SW1-if-range]undo port trunk permit vlan 1
[SW1-if-range]port trunk permit vlan 10 20 30 40
[SW1]int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/4
[SW1-if-range]port link-type trunk
[SW1-if-range]undo port trunk permit vlan 1
[SW1-if-range]port trunk permit vlan 10 20 30 40
SW2
[SW2]int range FortyGigE 1/0/53 to FortyGigE 1/0/54
[SW2-if-range]port link-type trunk
[SW2-if-range]undo port trunk permit vlan 1
[SW2-if-range]port trunk permit vlan 10 20 30 40
[SW2]int range GigabitEthernet 1/0/1 to GigabitEthernet 1/0/4
[SW2-if-range]port link-type trunk
[SW2-if-range]undo port trunk permit vlan 1
[SW2-if-range]port trunk permit vlan 10 20 30 40
SWA
[H3C]int range GigabitEthernet 1/0/1 GigabitEthernet 1/0/3
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
SWB
[H3C]int range GigabitEthernet 1/0/2 GigabitEthernet 1/0/4
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
SWC
[H3C]int range GigabitEthernet 1/0/3 GigabitEthernet 1/0/1
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
SWD
[H3C]int range GigabitEthernet 1/0/2 GigabitEthernet 1/0/4
[H3C-if-range]port link-type trunk
[H3C-if-range]undo port trunk permit vlan 1
[H3C-if-range]port trunk permit vlan 10 20 30 40
SW1
[SW1]int Bridge-Aggregation 1
[SW1-Bridge-Aggregation1]port link-type trunk
[SW1-Bridge-Aggregation1]undo port trunk permit vlan 1
[SW1-Bridge-Aggregation1]port trunk permit vlan 10 20 30 40
SW2
[SW2]int Bridge-Aggregation 1
[SW2-Bridge-Aggregation1]port link-type trunk
[SW2-Bridge-Aggregation1]undo port trunk permit vlan 1
[SW2-Bridge-Aggregation1]port trunk permit vlan 10 20 30 40
SW1
[SW1]int vlan 10 [SW1-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.10.1 //创建 VRRP 备份组10,并配置 VRRP 备份组 1 的虚拟 IP 地址为 192.168.10.1 [SW1-Vlan-interface10]vrrp vrid 10 priority 120 //设置 SW1 在 VRRP 备份组 1 中的优先级为110,高于 SW2 的优先级 100 ,以保证 SW1 成为 Master 负责转发流量。 [SW1-Vlan-interface10]vrrp vrid 10 preempt-mode delay 500 //设置 SW1 工作在抢占方式,以保证 SW1 故障恢复后,能再次抢占成为 Master ,即只要 SW1 正常工作,就由 SW1 负责转发流量。为了避免频繁地进行状态切换,配置抢占延迟时间为 500 厘秒。 [SW1-Vlan-interface10]qu [SW1]int vlan 20 [SW1-Vlan-interface20]vrrp vrid 20 virtual-ip 192.168.20.1 [SW1-Vlan-interface20]vrrp vrid 20 priority 120 [SW1-Vlan-interface20]vrrp vrid 20 preempt-mode delay 500 [SW1-Vlan-interface20]qu [SW1]int vlan 30 [SW1-Vlan-interface30]vrrp vrid 30 virtual-ip 192.168.30.1 [SW1-Vlan-interface30]vrrp vrid 30 priority 120 [SW1-Vlan-interface30]vrrp vrid 30 preempt-mode delay 500 [SW1-Vlan-interface30]int vlan 40 [SW1-Vlan-interface40]vrrp vrid 40 virtual-ip 192.168.40.1 [SW1-Vlan-interface40]vrrp vrid 40 priority 120 [SW1-Vlan-interface40]vrrp vrid 40 preempt-mode delay 500
SW2
[SW2-if-range]int vlan 10 [SW2-Vlan-interface10]vrrp vrid 10 virtual-ip 192.168.10.1 [SW2-Vlan-interface10]vrrp vrid 10 priority 100 [SW2-Vlan-interface10]vrrp vrid 10 preempt-mode delay 500 [SW2-Vlan-interface10]qu [SW2]int vlan 20 [SW2-Vlan-interface20]vrrp vrid 20 virtual-ip 192.168.20.1 [SW2-Vlan-interface20]vrrp vrid 20 priority 100 [SW2-Vlan-interface20]vrrp vrid 20 preempt-mode delay 500 [SW2-Vlan-interface20]int vlan 30 [SW2-Vlan-interface30]vrrp vrid 30 virtual-ip 192.168.30.1 [SW2-Vlan-interface30]vrrp vrid 30 priority 100 [SW2-Vlan-interface30]vrrp vrid 30 preempt-mode delay 500 [SW2-Vlan-interface30]int vlan 40 [SW2-Vlan-interface40]vrrp vrid 40 virtual-ip 192.168.40.1 [SW2-Vlan-interface40]vrrp vrid 40 priority 100 [SW2-Vlan-interface40]vrrp vrid 40 preempt-mode delay 500
SW1 为 VRRP 组 Master 设备,备份组 10 的虚拟 IP 地址为 192.168.10.1
SW2 为 VRRP 组 Backup 设备,备份组 10 的虚拟 IP 地址为 192.168.10.1
给4台 PC 机加上 IP 地址子网掩码和网关
PC 机的 IP 地址是相应 VLAN 可用的地址段,网关是该 VLAN 的 IP 地址
4台PC机可以相互ping 通
[SW1]stp instance 0 priority 0 //配置当前交换机的桥的优先级
[SW2]stp instance 0 priority 4096
SW1
[SW1]dhcp enable //使能 DHCP [SW1]dhcp server forbidden-ip 192.168.10.1 192.168.10.2 //配置 DHCP 地址池中不参与自动分配的 IP地址 [SW1]dhcp server forbidden-ip 192.168.20.1 192.168.20.2 [SW1]dhcp server forbidden-ip 192.168.30.1 192.168.30.2 [SW1]dhcp server forbidden-ip 192.168.40.1 192.168.40.2 [SW1]dhcp server ip-pool 10 //创建 DHCP 地址池 [SW1-dhcp-pool-10]gateway-list 192.168.10.1 //配置 DHCP 客户端分配的网关地址 [SW1-dhcp-pool-10]network 192.168.10.0 mask 255.255.255.0 //配置动态分配的 IP 地址范围 [SW1-dhcp-pool-10]qu [SW1]dhcp server ip-pool 20 [SW1-dhcp-pool-20]gateway-list 192.168.20.1 [SW1-dhcp-pool-20]network 192.168.20.0 mask 255.255.255.0 [SW1-dhcp-pool-20]qu [SW1]dhcp server ip-pool 30 [SW1-dhcp-pool-30]gateway-list 192.168.30.1 [SW1-dhcp-pool-30]network 192.168.30.0 mask 255.255.255.0 [SW1-dhcp-pool-30]dhcp server ip-pool 40 [SW1-dhcp-pool-40]gateway-list 192.168.40.1 [SW1-dhcp-pool-40]network 192.168.40.0 mask 255.255.255.0
SW2
[SW2]dhcp enable [SW2]dhcp server forbidden-ip 192.168.10.1 192.168.10.2 [SW2]dhcp server forbidden-ip 192.168.20.1 192.168.20.2 [SW2]dhcp server forbidden-ip 192.168.30.1 192.168.30.2 [SW2]dhcp server forbidden-ip 192.168.40.1 192.168.40.2 [SW2]dhcp server ip-pool 10 [SW2-dhcp-pool-10]gateway-list 192.168.10.1 [SW2-dhcp-pool-10]network 192.168.10.0 mask 255.255.255.0 [SW2-dhcp-pool-10]dhcp server ip-pool 20 [SW2-dhcp-pool-20]gateway-list 192.168.20.1 [SW2-dhcp-pool-20]network 192.168.20.0 mask 255.255.255.0 [SW2-dhcp-pool-20]dhcp server ip-pool 30 [SW2-dhcp-pool-30]gateway-list 192.168.30.1 [SW2-dhcp-pool-30]network 192.168.30.0 mask 255.255.255.0 [SW2-dhcp-pool-30]dhcp server ip-pool 40 [SW2-dhcp-pool-40]gateway-list 192.168.40.1 [SW2-dhcp-pool-40]network 192.168.40.0 mask 255.255.255.0
配置完完成后 PC 机可以通过 DHCP 获取到 IP 地址
接着测试PC之间的连通性
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。