静态路由实验综合
- 实验拓扑图
- 实验思路
- R6为公有地址,R5应该用NAT协议
- 减少路由表,同时避免环路,应该进行路由汇总,同时把网段分成6段,汇总后,进行配置空接口路由避免黑洞。
- 为了使每个网段都能ping通,我们应该采用静态路由配置
- 同时R1-R5都能访问R6,应该R1-R5采用路由缺省
R3下面的两台PC通过DHCP自动获取IP地址;R3先启用dhcp配置,创建地址池,然后网段网关全局接口打开dhcp.
- R4与R5正常通过1000M链路,故障时通过100m链路,R4应该用浮动路由。
- 网段的划分
骨干链路:192.168.1.0/27
R1-R2: 192.168.1.0/30
R1-R3: 192.168.1.4/30
R2-R4: 192.168.1.8/30
R3-R4: 192.168.1.12/30
R4-R5: 192.168.1.16/30
R5-R4: 192.168.1.20/30
R5-R6:12.0.0.0/24
r1环回:192.168.1.32/27
L1:192.168.1.32/28
L2:192.168.1.48/28
r2环回: 192.168.1.64/27
L1:192.168.1.64/28
L2:192.168.1.80/28
r3:192.168.1.96/27
r4环回: 192.168.1.128/27
L1:192.168.1.128/28
L2:192.168.1.144/28
r5环回192.168.1.160/27
r6环回1.0.0.0/24
- 路由器IP配置
R1
[r1-GigabitEthernet0/0/0]ip address 192.168.1.1 255.255.255.252
Mar 19 2024 11:10:05-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]int g0/0/1
[r1-GigabitEthernet0/0/1]ip ad 192.168.1.5 255.255.255.252
Mar 19 2024 11:11:57-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
[r1-GigabitEthernet0/0/1]int loopback0
[r1-LoopBack0]ip ad 192.168.1.33 255.255.255.240
[r1-LoopBack0]int loopback1
[r1-LoopBack1]ip ad 192.168.1.49 255.255.255.240
R2
r2-GigabitEthernet0/0/0]ip ad 192.168.1.2 255.255.255.252
Mar 19 2024 11:30:18-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]int g0/0/1
[r2-GigabitEthernet0/0/1]ip ad 192.168.1.9 255.255.255.252
Mar 19 2024 11:30:59-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]int loopb0
[r2-LoopBack0]ip ad 192.168.1.65 255.255.255.240
[r2-LoopBack0]int loopb1
[r2-LoopBack1]ip ad 192.168.1.49 255.255.255.240
R3
[r3-GigabitEthernet0/0/0]ip ad 192.168.1.6 255.255.255.252
Mar 19 2024 11:25:12-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int g0/0/1
[r3-GigabitEthernet0/0/1]ip ad 192.168.1.13 255.255.255.252
Mar 19 2024 11:26:05-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r3-GigabitEthernet0/0/1]int loopback0
[r3-GigabitEthernet0/0/2]ip ad 192.168.1.97 255.255.255.192
Mar 19 2024 21:14:07-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
R4
[r4-GigabitEthernet0/0/0]ip ad 192.168.1.10 255.255.255.252
[r4-GigabitEthernet0/0/0]
Mar 19 2024 11:39:26-08:00 r4 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r4-GigabitEthernet0/0/0]int g0/0/1
[r4-GigabitEthernet0/0/1]ip ad 192.168.1.14 255.255.255.252
Mar 19 2024 11:39:58-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r4-GigabitEthernet0/0/1]int g0/0/2
[r4-GigabitEthernet0/0/2]ip ad 192.168.1.17 255.255.255.252
[r4-GigabitEthernet0/0/2]
Mar 19 2024 11:40:50-08:00 r4 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r4-GigabitEthernet0/0/2]int g4/0/0
[r4-GigabitEthernet4/0/0]ip ad 192.168.1.21 255.255.255.252
[r4-GigabitEthernet4/0/0]
Mar 19 2024 11:41:23-08:00 r4 %%01IFNET/4/LINK_STATE(l)[3]:The line protocol IP
on the interface GigabitEthernet4/0/0 has entered the UP state.
[r4-GigabitEthernet4/0/0]int loopb0
[r4-LoopBack0]ip ad 192.168.1.129 255.255.255.240
[r4-LoopBack0]int loopb1
[r4-LoopBack1]ip ad 192.168.1.145 255.255.255.240
R5
[r5-GigabitEthernet0/0/0]ip ad 192.168.1.22 255.255.255.252
Mar 19 2024 12:12:00-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]int g0/0/2
[r5-GigabitEthernet0/0/2]ip ad 192.168.1.18 255.255.255.252
Mar 19 2024 12:13:06-08:00 r5 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
[r5-GigabitEthernet0/0/2]int g0/0/1
[r5-GigabitEthernet0/0/1]ip ad 12.0.0.1 255.255.255.0
[r5-GigabitEthernet0/0/1]
Mar 19 2024 12:14:02-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r5-GigabitEthernet0/0/1]int loopb0
[r5-LoopBack0]ip ad 192.168.1.161 255.255.255.192
R6
[r6-GigabitEthernet0/0/0]ip ad 12.0.0.2 255.255.255.0
[r6-GigabitEthernet0/0/0]
Mar 19 2024 12:17:08-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]int loopb0
[r6-LoopBack0]ip ad 1.0.0.1 255.255.255.0
- 实验配置
静态路由:
- 路由汇总,减少静态配置以及环路
- 缺省路由:防止黑洞,使内网ping通
R1
[r1]ip route-static 192.168.1.0 27 192.168.1.2
[r1]ip route-static 192.168.1.0 27 192.168.1.6
避免空接口路由产生环路
[r1]ip route-static 192.168.1.32 27 NULL0
到达R61.0.0.0/24 路由,使用缺省路由
[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
[r2]ip route-static 192.168.1.0 30 192.168.1.1
[r2]ip route-static 192.168.1.0 30 192.168.1.10
[r2]ip route-static 192.168.1.64 27 NULL0
[r2]ip route-static 0.0.0.0 0 192.168.1.1
[r2]ip route-static 0.0.0.0 0 192.168.1.10
R3
[r3]ip route-static 192.168.1.0 30 192.168.1.5
[r3]ip route-static 192.168.1.0 30 192.168.1.14
[r3]ip route-static 192.168.1.96 27 NULL0
[r3]ip route-static 0.0.0.0 0 192.168.1.5
[r3]ip route-static 0.0.0.0 0 192.168.1.14
R4
[r4]ip route-static 192.178.1.0 30 192.168.1.9
[r4]ip route-static 192.178.1.0 30 192.168.1.13
[r4]ip route-static 192.168.1.128 27 NULL0
[r4]ip route-static 0.0.0.0 0 192.168.1.13
[r4]ip route-static 0.0.0.0 0 192.168.1.9
[r4]ping 192.168.1.1
PING 192.168.1.1: 56 data bytes, press CTRL_C to break
Request time out
Reply from 192.168.1.1: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=3 ttl=254 time=30 ms
Reply from 192.168.1.1: bytes=56 Sequence=4 ttl=254 time=20 ms
Reply from 192.168.1.1: bytes=56 Sequence=5 ttl=254 time=30 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 20/27/30 ms
[r4]ip route-static 0.0.0.0 0 192.168.1.22 preference 61
Mar 20 2024 21:29:23-08:00 r4 %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEthern
et0/0/2 has turned into DOWN state.
[r4-GigabitEthernet0/0/2]shdown
Mar 20 2024 21:29:23-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the DOWN state.
R5
[r5]ip route-static 192.168.1.0 30 192.168.1.17
[r5]ip route-static 192.168.1.0 30 192.168.1.21
[[R5]ip route-static 192.168.1.0 30 192.168.1.17
[R5]ip route-static 192.168.1.0 30 192.168.1.21 preference 61
[R5]ip route-static 192.168.1.160 27 NULL0
R3下面的两台PC通过DHCP自动获取IP地址;
R3配置
先启用dhcp配置,创建地址池,然后网段网关全局接口打开dhcp,
[r3]dhcp enable
[r3]ip pool aa
[r3-ip-pool-aa]network 192.168.1.0 mask 24
[r3-ip-pool-aa]gateway-list 192.168.1.97
[r3-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[r3-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[r3]int g0/0/2
[r3-GigabitEthernet0/0/2]dhcp select global
PC1配置
命令行得到地址
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe6d:4ae
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.65
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.97
Physical address..................: 54-89-98-6D-04-AE
DNS server........................: 114.114.114.114
8.8.8.8