前言
一、需求
(1)链路聚合(10分):在SW1和SW2之间配置链路聚合,要求正常情况下有2条链路活跃、一条链路备份。
(2)M111STP(10分):正常情况下1各VLAN流量路径要求如下:
VLAN110:SW3->SW1->R1;VLAN020:SW3->SW2->R1;VLAN30:SW4->SW1->R1;VLAN40:SW4->SW2->R1
(3)VRRP(10分):正常情况下要求VLAN10、VLAN30的Master为SW1;VLAN20、VLAN40的Master为SW2
(4)DHCP(10分):R3为DHCP中继代理,R2为DHCP服务器,为PC5、PC6提供动态分配IP服务。
(15)在各三层交换机和路由器上配置静态路由或动态路由,使得所有PC终端能够网络互通(10分)。
二、命令(太多,只能简写)
1.LSW1
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan b 10 20 30 40 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p l t
[Huawei-GigabitEthernet0/0/2]p t a v a
[Huawei-GigabitEthernet0/0/2]int g0/0/6
[Huawei-GigabitEthernet0/0/6]p l a
[Huawei-GigabitEthernet0/0/6]p d v 100
[Huawei-GigabitEthernet0/0/6]q
[Huawei]lacp pri 1000
[Huawei]int eth-tr 1
[Huawei-Eth-Trunk1]bpdu enable
[Huawei-Eth-Trunk1]mode lacp-sta
[Huawei-Eth-Trunk1]p l t
[Huawei-Eth-Trunk1]p t a v a
[Huawei-Eth-Trunk1]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/3]int g0/0/4
[Huawei-GigabitEthernet0/0/4]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/4]int g0/0/5
[Huawei-GigabitEthernet0/0/5]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/5]q
[Huawei]int eth-tr 1
[Huawei-Eth-Trunk1]max active-linknumber 2
[Huawei-Eth-Trunk1]q
[Huawei]stp m mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 30
[Huawei-mst-region]ins 2 vlan 20 40
[Huawei-mst-region]q
[Huawei]stp ins 1 root pri
[Huawei]stp ins 2 root sec
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int vlan 10
[Huawei-Vlanif10]ip add 192.168.10.10 24
[Huawei-Vlanif10]int vlan 20
[Huawei-Vlanif20]ip add 192.168.20.10 24
[Huawei-Vlanif20]int vlan 30
[Huawei-Vlanif30]ip add 192.168.30.10 24
[Huawei-Vlanif30]int vlan 40
[Huawei-Vlanif40]ip add 192.168.40.10 24
[Huawei-Vlanif40]int vlan 100
[Huawei-Vlanif100]ip add 10.0.0.10 24
[Huawei-Vlanif100]q
[Huawei]int v 10
[Huawei-Vlanif10]vrrp vrid 10 vir 192.168.10.1
[Huawei-Vlanif10]vrrp vrid 10 pri 120
[Huawei-Vlanif10]vrrp vrid 10 track int g0/0/6 red 30
[Huawei-Vlanif10]int v 30
[Huawei-Vlanif30]vrrp vrid 30 vir 192.168.30.1
[Huawei-Vlanif30]vrrp vrid 30 pri 120
[Huawei-Vlanif30]vrrp vrid 30 track int g0/0/6 red 30
[Huawei-Vlanif30]int v 20
[Huawei-Vlanif20]vrrp vrid 20 vir 192.168.20.1
[Huawei-Vlanif20]int v 40
[Huawei-Vlanif40]vrrp vrid 40 vir 192.168.40.1
[Huawei-Vlanif40]int v 30
[Huawei-Vlanif40]q
[Huawei]rip 1
[Huawei-rip-1]version 2
[Huawei-rip-1]undo summary
[Huawei-rip-1]network 192.168.10.0
[Huawei-rip-1]network 192.168.30.0
[Huawei-rip-1]networ 10.0.0.0
2.LSW2
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan b 10 20 30 40 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int g 0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g 0/0/2
[Huawei-GigabitEthernet0/0/2]p l t
[Huawei-GigabitEthernet0/0/2]p t a v a
[Huawei-GigabitEthernet0/0/2]int g 0/0/6
[Huawei-GigabitEthernet0/0/6]p l a
[Huawei-GigabitEthernet0/0/6]p d v 100
[Huawei-GigabitEthernet0/0/6]q
[Huawei]lacp pri 1000
[Huawei]int eth-tr 1
[Huawei-Eth-Trunk1]bpdu enable
[Huawei-Eth-Trunk1]mod lacp-sta
[Huawei-Eth-Trunk1]p l t
[Huawei-Eth-Trunk1]p t a v a
[Huawei-Eth-Trunk1]trunk port e
[Huawei-Eth-Trunk1]q
[Huawei]int g0/0/3
[Huawei-GigabitEthernet0/0/3]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/3]int g0/0/4
[Huawei-GigabitEthernet0/0/4]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/4]int g0/0/5
[Huawei-GigabitEthernet0/0/5]eth-tr 1
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei-GigabitEthernet0/0/5]int eth-tr 1
[Huawei-Eth-Trunk1]max active-linknumber 2
[Huawei-Eth-Trunk1]q
[Huawei]stp m mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 30
[Huawei-mst-region]ins 2 vlan 20 40
[Huawei-mst-region]q
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]stp ins 1 root sec
[Huawei]stp ins 2 root pri
[Huawei]int vlan 100
[Huawei-Vlanif100]ip add 11.0.0.20 24
[Huawei-Vlanif100]int vlan 10
[Huawei-Vlanif10]ip add 192.168.10.20 24
[Huawei-Vlanif10]int vlan 20
[Huawei-Vlanif20]ip add 192.168.20.20 24
[Huawei-Vlanif20]int vlan 30
[Huawei-Vlanif30]ip add 192.168.30.20 24
[Huawei-Vlanif30]int vlan 40
[Huawei-Vlanif40]ip add 192.168.40.20 24
[Huawei-Vlanif40]q
[Huawei]int v 10
[Huawei-Vlanif10]vrrp vrid 10 vir 192.168.10.1
[Huawei-Vlanif10]int v 30
[Huawei-Vlanif30]vrrp vrid 30 vir 192.168.30.1
[Huawei-Vlanif30]int v 20
[Huawei-Vlanif20]vrrp vrid 20 vir 192.168.20.1
[Huawei-Vlanif20]vrrp vrid 20 pri 120
[Huawei-Vlanif20]vrrp vrid 20 track int g0/0/6 red 30
[Huawei-Vlanif20]int v 40
[Huawei-Vlanif40]vrrp vrid 40 vir 192.168.40.1
[Huawei-Vlanif40]vrrp vrid 40 pri 120
[Huawei-Vlanif40]vrrp vrid 40 track int g0/0/6 red 30
[Huawei-Vlanif40]q
[Huawei]rip 1
[Huawei-rip-1]version 2
[Huawei-rip-1]netw
[Huawei-rip-1]network 192.168.20.0
[Huawei-rip-1]network 192.168.40.0
[Huawei-rip-1]network 11.0.0.0
3.LSW3
代码如下(示例):
<Huawei>
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan b 10 20 30 40 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]p l a
[Huawei-Ethernet0/0/1]p d v 10
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]p l a
[Huawei-Ethernet0/0/2]p d v 20
[Huawei-Ethernet0/0/2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p l t
[Huawei-GigabitEthernet0/0/2]p t a v a
[Huawei-GigabitEthernet0/0/2]q
[Huawei]stp m mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 30
[Huawei-mst-region]ins 2 vlan 20 40
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
4.LSW4
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]vlan b 10 20 30 40 100
Info: This operation may take a few seconds. Please wait for a moment...done.
[Huawei]int e0/0/1
[Huawei-Ethernet0/0/1]p l a
[Huawei-Ethernet0/0/1]p d v 30
[Huawei-Ethernet0/0/1]int e0/0/2
[Huawei-Ethernet0/0/2]p l a
[Huawei-Ethernet0/0/2]p d v 40
[Huawei-Ethernet0/0/2]int g0/0/1
[Huawei-GigabitEthernet0/0/1]p l t
[Huawei-GigabitEthernet0/0/1]p t a v a
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]p l t
[Huawei-GigabitEthernet0/0/2]p t a v a
[Huawei-GigabitEthernet0/0/2]q
[Huawei]stp m mstp
[Huawei]stp re
[Huawei-mst-region]re huawei
[Huawei-mst-region]rev 1
[Huawei-mst-region]ins 1 vlan 10 30
[Huawei-mst-region]ins 2 v 20 40
[Huawei-mst-region]act re
Info: This operation may take a few seconds. Please wait for a moment...done.
5.R1
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 10.0.0.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 11.0.0.1 24
[Huawei-GigabitEthernet0/0/1]int g0/0/2
[Huawei-GigabitEthernet0/0/2]ip add 12.0.0.1 24
[Huawei-GigabitEthernet0/0/2]q
[Huawei]rip 1
[Huawei-rip-1]version 2
[Huawei-rip-1]undo summary
[Huawei-rip-1]network 10.0.0.0
[Huawei-rip-1]network 11.0.0.0
[Huawei-rip-1]network 12.0.0.0
6.R2
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]id 0 0
[Huawei-ui-console0]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 12.0.0.2 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 23.0.0.2 24
[Huawei-GigabitEthernet0/0/1]dhcp ena
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]ip pool 1
Info: It's successful to create an IP address pool.
[Huawei-ip-pool-1]gateway-list 192.168.100.1
[Huawei-ip-pool-1]network 192.168.100.0 mask 255.255.255.0
[Huawei-ip-pool-1]dns-list 8.8.8.8
[Huawei-ip-pool-1]lease day 7
[Huawei-ip-pool-1]int g0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp select global
[Huawei-GigabitEthernet0/0/1]q
[Huawei]rip
[Huawei-rip-1]version 2
[Huawei-rip-1]undo summary
[Huawei-rip-1]network 12.0.0.0
[Huawei-rip-1]network 23.0.0.0
7.R3
代码如下(示例):
<Huawei>u t m
Info: Current terminal monitor is off.
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]user- con 0
[Huawei-ui-console0]q
[Huawei]int g0/0/0
[Huawei-GigabitEthernet0/0/0]ip add 23.0.0.1 24
[Huawei-GigabitEthernet0/0/0]int g0/0/1
[Huawei-GigabitEthernet0/0/1]ip add 192.168.100.1 24
[Huawei-GigabitEthernet0/0/1]q
[Huawei]rip 1
[Huawei-rip-1]version 2
[Huawei-rip-1]undo summary
[Huawei-rip-1]network 23.0.0.0
[Huawei-rip-1]network 192.168.100.0
[Huawei-rip-1]q
[Huawei]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[Huawei]int g0/0/1
[Huawei-GigabitEthernet0/0/1]dhcp select relay
[Huawei-GigabitEthernet0/0/1]dhcp relay server-ip 23.0.0.2
3、通信结果(较多,拿PC6举例)
PC6(示例):
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fee1:36eb
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.100.253
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.100.1
Physical address..................: 54-89-98-E1-36-EB
DNS server........................: 8.8.8.8
PC>ping 192.168.10.100
Ping 192.168.10.100: 32 data bytes, Press Ctrl_C to break
From 192.168.10.100: bytes=32 seq=1 ttl=124 time=156 ms
From 192.168.10.100: bytes=32 seq=2 ttl=124 time=78 ms
From 192.168.10.100: bytes=32 seq=3 ttl=124 time=78 ms
From 192.168.10.100: bytes=32 seq=4 ttl=124 time=109 ms
From 192.168.10.100: bytes=32 seq=5 ttl=124 time=110 ms
--- 192.168.10.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/106/156 ms
PC>ping 192.168.20.100
Ping 192.168.20.100: 32 data bytes, Press Ctrl_C to break
From 192.168.20.100: bytes=32 seq=1 ttl=124 time=140 ms
From 192.168.20.100: bytes=32 seq=2 ttl=124 time=94 ms
From 192.168.20.100: bytes=32 seq=3 ttl=124 time=78 ms
From 192.168.20.100: bytes=32 seq=4 ttl=124 time=94 ms
From 192.168.20.100: bytes=32 seq=5 ttl=124 time=78 ms
--- 192.168.20.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/96/140 ms
PC>ping 192.168.30.100
Ping 192.168.30.100: 32 data bytes, Press Ctrl_C to break
From 192.168.30.100: bytes=32 seq=1 ttl=124 time=140 ms
From 192.168.30.100: bytes=32 seq=2 ttl=124 time=94 ms
From 192.168.30.100: bytes=32 seq=3 ttl=124 time=78 ms
From 192.168.30.100: bytes=32 seq=4 ttl=124 time=109 ms
From 192.168.30.100: bytes=32 seq=5 ttl=124 time=94 ms
--- 192.168.30.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 78/103/140 ms
PC>ping 192.168.40.100
Ping 192.168.40.100: 32 data bytes, Press Ctrl_C to break
From 192.168.40.100: bytes=32 seq=1 ttl=124 time=141 ms
From 192.168.40.100: bytes=32 seq=2 ttl=124 time=94 ms
From 192.168.40.100: bytes=32 seq=3 ttl=124 time=94 ms
From 192.168.40.100: bytes=32 seq=4 ttl=124 time=93 ms
From 192.168.40.100: bytes=32 seq=5 ttl=124 time=94 ms
--- 192.168.40.100 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 93/103/141 ms
PC>ping 192.168.100.254
Ping 192.168.100.254: 32 data bytes, Press Ctrl_C to break
From 192.168.100.254: bytes=32 seq=1 ttl=128 time=47 ms
From 192.168.100.254: bytes=32 seq=2 ttl=128 time=47 ms
From 192.168.100.254: bytes=32 seq=3 ttl=128 time=31 ms
From 192.168.100.254: bytes=32 seq=4 ttl=128 time=31 ms
From 192.168.100.254: bytes=32 seq=5 ttl=128 time=47 ms
--- 192.168.100.254 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 31/40/47 ms
4、总结
暂时没用OSPF,用了的话会简单很多,先不用OSPF来试试的,成功了。