需求:
PC间能够互相ping通
分析:
图中有五个网段,非通过路由器直连的两个网段不能直连,要进行静态路由操作在路由器的路由表中添加Destintion才能连接
配置内容:
1.配置各pc和路由器各接口的ip地址
AR4:
[r4]interface GigabitEthernet 0/0/0
[r4-GigabitEthernet0/0/0]ip add
[r4-GigabitEthernet0/0/0]ip address 12.1.1.1 30
Apr 21 2023 09:14:38-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]q
[r4]in
[r4]info-center
[r4]interface g
[r4]interface GigabitEthernet 0/0/1
[r4-GigabitEthernet0/0/1]ip address 192.168.1.1 24
Apr 21 2023 09:15:44-08:00 r4 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
AR5:
[r5]interface GigabitEthernet 0/0/0
[r5-GigabitEthernet0/0/0]ip address 12.1.1.2 30
Apr 21 2023 09:18:06-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]in
[r5]info-center
[r5]interface g
[r5]interface GigabitEthernet 0/0/1
[r5-GigabitEthernet0/0/1]ip address 23.1.1.1 30
Apr 21 2023 09:19:18-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]interface GigabitEthernet 0/0/2
[r5-GigabitEthernet0/0/2]in
[r5-GigabitEthernet0/0/2]in
[r5-GigabitEthernet0/0/2]ip address 192.168.2.1 24
[r5-GigabitEthernet0/0/2]
Apr 21 2023 09:20:35-08:00 r5 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
AR6:
[r6]interface GigabitEthernet 0/0/0
[r6-GigabitEthernet0/0/0]ip address 23.1.1.2 30
Apr 21 2023 09:21:47-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
[r6]int
[r6]interface g
[r6]interface GigabitEthernet 0/0/1
[r6-GigabitEthernet0/0/1]ip address 192.168.3.1 24
[r6-GigabitEthernet0/0/1]
Apr 21 2023 09:23:05-08:00 r6 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
2. 进行静态路由操作
AR4:
[r6]ip route-static 192.168.2.0 24 23.1.1.1
[r6]ip route-static 12.1.1.0 30 23.1.1.1
[r6]ip route-static 192.168.1.0 24 23.1.1.1
AR5:
[r5]ip route-static 192.168.1.0 24 12.1.1.1
[r5]ip route-static 192.168.3.0 24 23.1.1.2
AR6:
[r6]ip route-static 192.168.2.0 24 23.1.1.1
[r6]ip route-static 12.1.1.0 30 23.1.1.1
[r6]ip route-static 192.168.1.0 24 23.1.1.1
测试结果
PC1:
PC>ping 192.168.2.2
Ping 192.168.2.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.2.2: bytes=32 seq=3 ttl=126 time=16 ms
From 192.168.2.2: bytes=32 seq=4 ttl=126 time=15 ms
From 192.168.2.2: bytes=32 seq=5 ttl=126 time=16 ms
--- 192.168.2.2 ping statistics ---
5 packet(s) transmitted
3 packet(s) received
40.00% packet loss
round-trip min/avg/max = 0/15/16 ms
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.3.2: bytes=32 seq=3 ttl=125 time=31 ms
From 192.168.3.2: bytes=32 seq=4 ttl=125 time=16 ms
From 192.168.3.2: bytes=32 seq=5 ttl=125 time=16 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
3 packet(s) received
40.00% packet loss
round-trip min/avg/max = 0/21/31 ms
PC2:
PC>ping 192.168.3.2
Ping 192.168.3.2: 32 data bytes, Press Ctrl_C to break
From 192.168.3.2: bytes=32 seq=1 ttl=126 time=31 ms
From 192.168.3.2: bytes=32 seq=2 ttl=126 time=16 ms
From 192.168.3.2: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.3.2: bytes=32 seq=4 ttl=126 time=16 ms
From 192.168.3.2: bytes=32 seq=5 ttl=126 time=16 ms
--- 192.168.3.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 16/22/31 ms