实验拓扑:
实验需求:
1.全网可达
2.所有地址基于192.168.0.0 24 划分
3.使用静态路由
4.R8环回汇总
配置二层设备
思路是先进行终端VLAN的划分,把交换机的配置都配完,并且让终端启用DHCP服务。
LSW1:
首先创建VLAN2 和VLAN 3
[LSW1]vlan 2
[LSW1-vlan2]q
[LSW1]v
[LSW1]vlan 3
[LSW1-vlan3]q
[LSW1]int g 0/0/2
[LSW1-GigabitEthernet0/0/2]p
[LSW1-GigabitEthernet0/0/2]port l
[LSW1-GigabitEthernet0/0/2]port link-t
[LSW1-GigabitEthernet0/0/2]port link-type a
[LSW1-GigabitEthernet0/0/2]port link-type access
[LSW1-GigabitEthernet0/0/2]p
[LSW1-GigabitEthernet0/0/2]port d
[LSW1-GigabitEthernet0/0/2]port discard
[LSW1-GigabitEthernet0/0/2]port default v
[LSW1-GigabitEthernet0/0/2]port default vlan 2
[LSW1-GigabitEthernet0/0/2]int g 0/0/3
[LSW1-GigabitEthernet0/0/3]p
[LSW1-GigabitEthernet0/0/3]port l
[LSW1-GigabitEthernet0/0/3]port link-t
[LSW1-GigabitEthernet0/0/3]port link-type a
[LSW1-GigabitEthernet0/0/3]port link-type access
[LSW1-GigabitEthernet0/0/3]p
[LSW1-GigabitEthernet0/0/3]port d
[LSW1-GigabitEthernet0/0/3]port discard
[LSW1-GigabitEthernet0/0/3]port default v
[LSW1-GigabitEthernet0/0/3]port default vlan 3
[LSW1-GigabitEthernet0/0/3]int g 0/0/4
[LSW1-GigabitEthernet0/0/4]p
[LSW1-GigabitEthernet0/0/4]port t
[LSW1-GigabitEthernet0/0/4]port type l
[LSW1-GigabitEthernet0/0/4]port t
[LSW1-GigabitEthernet0/0/4]port type
[LSW1-GigabitEthernet0/0/4]port type
[LSW1-GigabitEthernet0/0/4]port l
[LSW1-GigabitEthernet0/0/4]port link-t
[LSW1-GigabitEthernet0/0/4]port link-type t
[LSW1-GigabitEthernet0/0/4]port link-type trunk
[LSW1-GigabitEthernet0/0/4]p
[LSW1-GigabitEthernet0/0/4]port t
[LSW1-GigabitEthernet0/0/4]port trunk a
[LSW1-GigabitEthernet0/0/4]port trunk allow-pass
[LSW1-GigabitEthernet0/0/4]int g 0/0/1
[LSW1-GigabitEthernet0/0/1]dis
[LSW1-GigabitEthernet0/0/1]display th
[LSW1-GigabitEthernet0/0/1]display this
#
interface GigabitEthernet0/0/1
#
return
[LSW1-GigabitEthernet0/0/1]po
[LSW1-GigabitEthernet0/0/1]port l
[LSW1-GigabitEthernet0/0/1]port link-t
[LSW1-GigabitEthernet0/0/1]port link-type t
[LSW1-GigabitEthernet0/0/1]port link-type trunk
[LSW1-GigabitEthernet0/0/1]p
[LSW1-GigabitEthernet0/0/1]port t
[LSW1-GigabitEthernet0/0/1]port trunk a
[LSW1-GigabitEthernet0/0/1]port trunk allow-pass
lsw2
[LSW2]int g 0/0/1
[LSW2-GigabitEthernet0/0/1]dis
[LSW2-GigabitEthernet0/0/1]display th
[LSW2-GigabitEthernet0/0/1]display this
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
#
return
[LSW2-GigabitEthernet0/0/1]int g 0/0/2
[LSW2-GigabitEthernet0/0/2]dis
[LSW2-GigabitEthernet0/0/2]display th
[LSW2-GigabitEthernet0/0/2]display this
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 2
#
return
[LSW2-GigabitEthernet0/0/2]int g 0/0/3
[LSW2-GigabitEthernet0/0/3]dis
[LSW2-GigabitEthernet0/0/3]display th
[LSW2-GigabitEthernet0/0/3]display this
#
interface GigabitEthernet0/0/3
port link-type access
port default vlan 3
#
return
R4
[R4-GigabitEthernet0/0/2.1]display this
[V200R003C00]
#
interface GigabitEthernet0/0/2.1
dot1q termination vid 2
ip address 192.168.0.1 255.255.255.240
arp broadcast enable
dhcp select global
#
return
[R4-GigabitEthernet0/0/2.1]int g 0/0/2.2
[R4-GigabitEthernet0/0/2.2]dh
[R4-GigabitEthernet0/0/2.2]dhcp se
[R4-GigabitEthernet0/0/2.2]dhcp select go
[R4-GigabitEthernet0/0/2.2]dhcp select g
[R4-GigabitEthernet0/0/2.2]dhcp select global
[R4-GigabitEthernet0/0/2.2]dis
[R4-GigabitEthernet0/0/2.2]discard
[R4-GigabitEthernet0/0/2.2]display th
[R4-GigabitEthernet0/0/2.2]display this
[V200R003C00]
#
interface GigabitEthernet0/0/2.2
dot1q termination vid 3
ip address 192.168.0.17 255.255.255.240
arp broadcast enable
dhcp select global
#
return
[R4]ip route-static 192.168.0.224 27 192.168.0.193
[R4]
[R4]ip route-static 192.168.0.32 27 192.168.0.193
[R4]
[R4]ip route-static 192.168.0.64 27 192.168.0.162
[R4]
[R4]ip route-static 192.168.0.96 27 192.168.0.162
[R4]
[R4]ip route-static 192.168.0.128 27 192.168.0.162
R2
[Huawei]sys R2
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip ad
[R2-GigabitEthernet0/0/1]ip address 192.168.0.193 27
Jul 17 2023 13:15:12-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[R2-GigabitEthernet0/0/1]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip ad
[R2-GigabitEthernet0/0/0]ip address 192.168.0.32 27
Error: The specified IP address is invalid.
[R2-GigabitEthernet0/0/0]ip address 192.168.0.33 27
Jul 17 2023 13:15:32-08:00 R2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R2-GigabitEthernet0/0/0]q
[R2]int l
[R2]int LoopBack 0
[R2-LoopBack0]ip ad
[R2-LoopBack0]ip address 192.168.0.225 29
[R2-LoopBack0]q
[R2]int l 1
[R2-LoopBack1]ip ad
[R2-LoopBack1]ip address 192.168.0.233 29
[R2-LoopBack1]q
[R2]int l 2
[R2-LoopBack2]ip ad
[R2-LoopBack2]ip address 192.168.0.241 29
[R2-LoopBack2]q
[R2]int l 3
[R2-LoopBack3]ip ad
[R2-LoopBack3]ip address 192.168.0.249 29
[R2-LoopBack3]q
[R2]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 7
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 7
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.0.33/27 up up
GigabitEthernet0/0/1 192.168.0.193/27 up up
GigabitEthernet0/0/2 unassigned down down
LoopBack0 192.168.0.225/29 up up(s)
LoopBack1 192.168.0.233/29 up up(s)
LoopBack2 192.168.0.241/29 up up(s)
LoopBack3 192.168.0.249/29 up up(s)
NULL0 unassigned up up(s)
[R2]
[R2]ip route-static 192.168.0.64 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.96 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.128 27 192.168.0.34
[R2]
[R2]ip route-static 192.168.0.0 28 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.16 28 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.160 27 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.96 27 192.168.0.194
[R2]
[R2]ip route-static 192.168.0.128 27 192.168.0.194
R1
[R1]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 3
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 3
The number of interface that is DOWN in Protocol is 1
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.0.34/27 up up
GigabitEthernet0/0/1 192.168.0.65/27 up up
GigabitEthe
[R1]ip route-static 192.168.0.224 27 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.192 27 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.0 28 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.16 28 192.168.0.33
[R1]
[R1]ip route-static 192.168.0.160 27 192.168.0.66
[R1]
[R1]ip route-static 192.168.0.0 28 192.168.0.66
[R1]
[R1]ip route-static 192.168.0.16 28 192.168.0.66
R3
[R3]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 5
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 5
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.0.66/27 up up
GigabitEthernet0/0/1 192.168.0.162/27 up up
GigabitEthernet0/0/2 192.168.0.129/27 up up
GigabitEthernet4/0/0 192.168.0.97/27 up up
NULL0
[R3]ip route-static 192.168.0.16 28 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.0 28 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.192 27 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.224 27 192.168.0.161
[R3]
[R3]ip route-static 192.168.0.32 27 192.168.0.65
[R3]
[R3]ip route-static 192.168.0.224 27 192.168.0.65
R5
[R5]display ip interface brief
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0
Interface IP Address/Mask Physical Protocol
GigabitEthernet0/0/0 192.168.0.130/27 up up
GigabitEthernet0/0/1 192.168.0.98/27 up up
GigabitEthernet0/0/2 100.1.1.1/24 up up
NULL0
[R5]ip route-static 192.168.0.64 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.64 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.32 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.32 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.224 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.224 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.160 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.160 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.192 27 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.192 27 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.0 28 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.0 28 192.168.0.129
[R5]
[R5]ip route-static 192.168.0.16 28 192.168.0.97
[R5]
[R5]ip route-static 192.168.0.16 28 192.168.0.129
[R5]acl 2000
[R5-acl-basic-2000]rule permit source 192.168.0.0 0.0.0.255
[R5]int g 0/0/2
[R5-GigabitEthernet0/0/2]nat outbound 2000
R6
[Huawei]sys R6
[R6]int g 0/0/0
[R6-GigabitEthernet0/0/0]ip ad
[R6-GigabitEthernet0/0/0]ip address 100.1.1.2 24
Jul 17 2023 13:24:23-08:00 R6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
配置缺省路由
[R4]ip route-static 0.0.0.0 0 192.168.0.162
[R4]ip route-static 192.168.0.224 27 NULL 0
[R2]ip route-static 0.0.0.0 0 192.168.0.194
[R1]ip route-static 0.0.0.0 0 192.168.0.66
[R1]ip route-static 192.168.0.224 27 NULL 0
[R3]ip route-static 0.0.0.0 0 192.168.0.98
[R3]ip route-static 0.0.0.0 0 192.168.0.130
[R5]ip route-static 0.0.0.0 0 100.1.1.2
测试之后,试验成功。