一:实验要求
二:实验步骤
1.搭建拓扑
2.划分好地址之后我们对各个路由器,网段配 地址
R1
环回地址
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 192.168.1.33 28
[r1-LoopBack0]q
[r1]interface LoopBack 1
[r1-LoopBack1]ip add 192.168.1.49 28
[r1-LoopBack1]q接口IP
[r1]interface g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.1.1 30
Jan 21 2024 22:24:39-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]q
[r1]interface g 0/0/1
[r1-GigabitEthernet0/0/1]ip add 192.168.1.9 30
Jan 21 2024 22:25:18-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r1-GigabitEthernet0/0/1]q
R2
环回地址
[r2]interface LoopBack 0
[r2-LoopBack0]ip add 192.168.1.65 28
[r2-LoopBack0]q
[r2]interface LoopBack 1
[r2-LoopBack1]ip address 192.168.1.81 28
[r2-LoopBack1]q接口地址
[r2]interface g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 192.168.1.2 30
Jan 21 2024 22:26:49-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]q
[r2]interface g 0/0/1
[r2-GigabitEthernet0/0/1]ip add 192.168.1.5 30
[r2-GigabitEthernet0/0/1]
Jan 21 2024 22:27:11-08:00 r2 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r2-GigabitEthernet0/0/1]q
R3
接口地址
[r3]interface g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 192.168.1.10 30
Jan 21 2024 22:32:22-08:00 r3 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]q
[r3]interface g 0/0/1
[r3-GigabitEthernet0/0/1]ip add
[r3-GigabitEthernet0/0/1]ip address 192.168.1.13 30
Jan 21 2024 22:32:43-08:00 r3 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]q
R4
环回地址
[r4]interface LoopBack 0
[r4-LoopBack0]ip address 192.168.1.129 28
[r4-LoopBack0]q
[r4]interface LoopBack 1
[r4-LoopBack1]ip add 192.168.1.145 28
[r4-LoopBack1]q接口地址
[r4]interface g 0/0/0
[r4-GigabitEthernet0/0/0]ip add 192.168.1.6 30
Jan 21 2024 22:28:39-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]q
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip add 192.168.1.14 30
Jan 21 2024 22:28:59-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]q
[r4]interface g 0/0/2
[r4-GigabitEthernet0/0/2]ip add 192.168.1.17 30
[r4-GigabitEthernet0/0/2]
Jan 21 2024 22:29:33-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]q
[r4]interface e 3/0/0
[r4-Ethernet3/0/0]ip add 192.168.1.21 30
[r4-Ethernet3/0/0]
Jan 21 2024 22:30:05-08:00 r4 %%01IFNET/4/LINK_STATE(l)[4]:The line protocol IP
on the interface Ethernet3/0/0 has entered the UP state.
[r4-Ethernet3/0/0]q
R5
环回地址
[r5]interface LoopBack 0
[r5-LoopBack0]ip address 12.12.12.12 24
[r5-LoopBack0]q接口地址
[r5]interface g 0/0/0
[r5-GigabitEthernet0/0/0]ip add 192.168.1.18 30
Jan 21 2024 22:34:32-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r5-GigabitEthernet0/0/0]q
[r5]interface g 0/0/1
[r5-GigabitEthernet0/0/1]ip add 192.168.1.22 30
Jan 21 2024 22:34:53-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]q[r5]interface g 0/0/2
[r5-GigabitEthernet0/0/2]ip add 192.168.1.25 30
[r5-GigabitEthernet0/0/2]
Jan 21 2024 22:39:01-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]q
R6
环回地址
[r6]interface LoopBack 0
[r6-LoopBack0]ip address 1.1.1.1 24
[r6-LoopBack0]q接口地址
[r6]interface g 0/0/0
[r6-GigabitEthernet0/0/0]ip add
[r6-GigabitEthernet0/0/0]ip address 192.168.1.26 30
Jan 21 2024 22:40:02-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r6-GigabitEthernet0/0/0]q
3.R3下的两台PC通过DHCP自动获取IP
该接口端口网段IP
[r3]interface g 0/0/2
[r3-GigabitEthernet0/0/2]ip add
[r3-GigabitEthernet0/0/2]ip address 192.168.1.100 27
[r3-GigabitEthernet0/0/2]q
建立IP池塘
[r3]dhcp enable
[r3]ip pool 1
Info: It's successful to create an IP address pool.
[r3-ip-pool-1]network 192.168.1.96 mask 27
[r3-ip-pool-1]gateway-list 192.168.1.97
[r3-ip-pool-1]q
[r3]interface g 0/0/2
[r3-GigabitEthernet0/0/2]dhcp select global
查看PC地址
4.选路佳,路由表尽量少,避免环路
静态路由
R1
[r1]ip route-static 192.168.1.64 27 192.168.1.2
[r1]ip route-static 192.168.1.4 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.10[r1]ip route-static 192.168.1.12 30 192.168.1.10
[r1]ip route-static 192.168.1.16 30 192.168.1.10
[r1]ip route-static 192.168.1.16 30 192.168.1.2
[r1]ip route-static 192.168.1.24 30 192.168.1.2
[r1]ip route-static 192.168.1.24 30 192.168.1.10
R2
[r2]ip route-static 192.168.1.32 27 192.168.1.1
[r2]ip route-static 192.168.1.128 27 192.168.1.6
[r2]ip route-static 192.168.1.8 30 192.168.1.1
[r2]ip route-static 192.168.1.12 30 192.168.1.6
[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.6
[r2]ip route-static 192.168.1.16 30 192.168.1.6
[r2]ip route-static 192.168.1.24 30 192.168.1.6
R3
[r3]ip route-static 192.168.1.32 27 192.168.1.9
[r3]ip route-static 192.168.1.0 30 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.9
[r3]ip route-static 192.168.1.64 27 192.168.1.14
[r3]ip route-static 192.168.1.128 27 192.168.1.14
[r3]ip route-static 192.168.1.4 30 192.168.1.14
[r3]ip route-static 192.168.1.16 30 192.168.1.14
[r3]ip route-static 192.168.1.24 30 192.168.1.14
R4
R5
[r5]ip route-static 192.168.1.4 30 192.168.1.17
[r5]ip route-static 192.168.1.64 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.32 27 192.168.1.17
[r5]ip route-static 192.168.1.12 30 192.168.1.17
[r5]ip route-static 192.168.1.96 27 192.168.1.17
[r5]ip route-static 192.168.1.8 30 192.168.1.17
R6
[r6]ip route-static 192.168.1.16 30 192.168.1.25
[r6]ip route-static 192.168.1.20 30 192.168.1.25
[r6]ip route-static 192.168.1.128 27 192.168.1.25
[r6]ip route-static 192.168.1.64 27 192.168.1.25
[r6]ip route-static 192.168.1.96 27 192.168.1.25
[r6]ip route-static 192.168.1.32 27 192.168.1.25
[r6]ip route-static 192.168.1.4 30 192.168.1.25
[r6]ip route-static 192.168.1.12 30 192.168.1.25
[r6]ip route-static 192.168.1.8 30 192.168.1.25
[r6]ip route-static 192.168.1.0 30 192.168.1.25
避免环路 (做个空接口)
R1
[r1]ip route-static 192.168.1.32 27 NULL 0
R2
[r2]IP route-static 192.168.1.64 27 NULL 0
R3
[r3]IP route-static 192.168.1.96 27 NULL 0
R4
[r4]IP route-static 192.168.1.128 27 NULL 0
R5
[r5]IP route-static 192.168.1.16 30 NULL 0
5.R1-R5均可以访问R6环回(写缺省)
R1
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.2
[r1]ip route-static 0.0.0.0 0.0.0.0 192.168.1.10
R2
[r2]IP route-static 0.0.0.0 0.0.0.0 192.168.1.6
R3
[r3]IP route-static 0.0.0.0 0.0.0.0 192.168.1.14
R4
[r4]IP route-static 0.0.0.0 0.0.0.0 192.168.1.18
R5
[r5]IP route-static 0.0.0.0 0.0.0.0 192.168.1.26
R1pingR6
6.R4与R5 正常走1000M链路.故障时走100链路(改优先级)
R4
[r4]ip route-static 0.0.0.0 0.0.0.0 192.168.1.22 pre 61
R5
[r5]ip route-static 192.168.1.128 27 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.64 27 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.96 27 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.32 27 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.4 30 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.8 30 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.0 30 192.168.1.21 pre 61
[r5]ip route-static 192.168.1.12 30 192.168.1.21 pre 61
我们先把R4的0/0/2 接口shutdown
接下来查看
7.R6telnetR5的公有IP地址时,实际登陆到R1上
在R5上设置ACL和登录设置的秘钥
[r5]aaa
[r5-aaa]local-user taoshaui privilege level 15 password cipher 123456
[r5-aaa]q
[r5]user-bind
[r5]user-group
[r5]user-interface vty 0 4
[r5-ui-vty0-4]au
[r5-ui-vty0-4]authentication-mode aaa
[r5-ui-vty0-4]q