一.搭建拓扑结构
1.根据拓扑结构可以把网段分成14个网段,根据192.168.1.0/24可以划分出ip地址和环回地址
其中环回r1分别是
192.168.1.32/27
192.168.1.32/28
192.168.1.48/28
2.划分完后如图:
二.配置IP地址
注意:为了避免错误,事先计算好每个网段的IP地址和环回地址,然后分配一个路由器把两个一起配置
r1路由器:
1.进入华为系统视图并改名
2.接口配置IP地址
分别进入GE0/0/0接口和GE0/0/1接口配置IP
3.配置环回接口
4.检查配置信息,即查看接口IP地址的摘要信息:
[r1]display ip interface brief
5.配置其他的路由器
同理可得以下:
r2:
r3:
r4:
r5:
r6:
6.编写静态路由
r1路由器:
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.8 30 192.168.1.2
[r1]ip route-static 192.168.1.128 27 192.168.1.2
[r1]ip route-static 192.168.1.128 27 192.168.1.6
[r1]ip route-static 192.168.1.12 30 192.168.1.6
[r1]ip route-static 192.168.1.96 27 192.168.1.6
[r1]ip route-static 192.168.1.16 30 192.168.1.6
[r1]ip route-static 192.168.1.16 30 192.168.1.2
查看:
[r1]display ip routing-table protocol static
r2:
[r2]ip route-static 192.168.1.4 30 192.168.1.1
[r2]ip route-static 192.168.1.12 30 192.168.1.10
[r2]ip route-static 192.168.1.96 27 192.168.1.1
[r2]ip route-static 192.168.1.96 27 192.168.1.10
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.32 27 192.168.1.10
r3:
[r3]ip route-static 192.168.1.32 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.5
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.128 27 192.168.1.14
[r3]ip route-static 192.168.1.8 30 192.168.1.14
[r3]ip route-static 192.168.1.16 30 192.168.1.14
r4:
[r4]ip route-static 192.168.1.32 27 192.168.1.13
[r4]ip route-static 192.168.1.32 27 192.168.1.9
[r4]ip route-static 192.168.1.0 30 192.168.1.9
[r4]ip route-static 192.168.1.4 30 192.168.1.13
[r4]ip route-static 192.168.1.96 27 192.168.1.13
[r4]ip route-static 192.168.1.64 27 192.168.1.9
r5:
[r5]ip route-static 192.168.1.32 27 192.168.1.17
[r5]ip route-static 192.168.1.64 27 192.168.1.17
[r5]ip route-static 192.168.1.96 27 192.168.1.17
[r5]ip route-static 192.168.1.128 27 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.4 30 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
[r5]ip route-static 192.168.1.12 30 192.168.1.17
三.缺省路由
[r1]ip route-static 0.0.0.0 0 192.168.1.2
[r1]ip route-static 0.0.0.0 0 192.168.1.6
[r2]ip route-static 0.0.0.0 0 192.168.1.10
[r3]ip route-static 0.0.0.0 0 192.168.1.14
[r4]ip route-static 0.0.0.0 0 192.168.1.18
[r5]ip route-static 0.0.0.0 0 12.0.0.2
四.避免环路出现,编写空接口
[r1]ip route-static 192.168.1.32 27 NULL 0
[r2]ip route-static 192.168.1.64 27 NULL 0
[r3]ip route-static 192.168.1.96 27 NULL 0
[r4]ip route-static 192.169.1.128 27 NULL 0
[r5]ip route-static 192.168.1.160 27 NULL 0
五.PC通信:ping + ip地址
六.走百兆口配IP
[r1]ip route-static 192.168.1.20 30 192.168.1.2
[r1]ip route-static 192.168.1.20 30 192.168.1.6
[r2]ip route-static 192.168.1.20 30 192.168.1.10
[r3]ip route-static 192.168.1.20 30 192.168.1.14
#此时在r4上更改优先级
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
[r5]display this
七.均可访问R6环回:
ping r6 环回
每个路由器能接收到报文就代表成功
八.配置DHCP服务器(R3),下发给主机IP
[R3]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[R3]ip pool aa
Info:It's successful to create an IP address pool.
[R3-ip-pool-aa]network 192.168.1.96 mask 27
[R3-ip-pool-aa]gateway-list 192.168.1.97
[R3-ip-pool-aa]dns-list 114.114.114.114
[R3-ip-pool-aa]int g 0/0/2
[R3-GigabitEthernet0/0/2]dhcp select global
九.R6 telnet R5,实则登录R1
[R1]aaa
[R1-aaa]local-user admin privilege level 15 password cipher 123456
[R1-aaa]local-user admin service-type telnet
[R1]user-interface vty 0 4
[R1-ui-vty0-4]authentication-mode aaa
R5:
[R5-GigabitEthernet0/0/1]nat server protocol tcp global current-interface 23 inside 192.168.1.1 23
Warning:The port 23 is well-known port. If you continue it may cause function failure.
Are you sure to continue?[Y/N]:y
R6验证:
<R6>telnet 12.0.0.2
Trying 12.0.0.2 ...
Press CTRL+K to abort
Connected to 12.0.0.2 ...
Login authentication
Username:admin
Password:
Info: The max number of VTY users is 10, and the number of current VTY users on line is 1.
The current login time is 2024-03-18 22:16:39.
<R1>
<R1>q
<R6>
则表示验证成功!