拓扑图
需求分析
各pc之间可以ping通
配置内容
1.配置各端口ip
r1
[r1]interface GigabitEthernet 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.1.2 24
Apr 23 2023 17:29:42-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]int g 0/0/1
[r1-GigabitEthernet0/0/1]ip address 12.1.1.1 30
Apr 23 2023 17:30:13-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
r2
[r2]interface GigabitEthernet 0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 30
Apr 23 2023 17:31:07-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 address 12.1.1.2 30
Apr 23 2023 17:31:56-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]int g 0/0/2
[r2-GigabitEthernet0/0/2]ip address 192.168.2.2 24
[r2-GigabitEthernet0/0/2]
Apr 23 2023 17:32:22-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP
on the interface GigabitEthernet0/0/2 has entered the UP state.
r3
[r3]interface GigabitEthernet 0/0/0
[r3-GigabitEthernet0/0/0]ip address 23.1.1.2 30
Apr 23 2023 17:32:59-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 g 0/0/1
[r3-GigabitEthernet0/0/1]ip address 192.168.3.2 24
Apr 23 2023 17:33:19-08:00 r3 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
2.配置各pc的ip
pc1
pc2
pc3
3.配置静态路由并查看
r1
[r1]ip route-static 192.168.2.0 24 12.1.1.2
[r1]ip route-static 23.1.1.0 30 12.1.1.2
[r1]ip route-static 192.168.3.0 24 12.1.1.2
[r1]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/30 Direct 0 0 D 12.1.1.1 GigabitEthernet
0/0/1
12.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
12.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.1.1.0/30 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Direct 0 0 D 192.168.1.2 GigabitEthernet
0/0/0
192.168.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
192.168.2.0/24 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/1
192.168.3.0/24 Static 60 0 RD 12.1.1.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
pc2
[r2]ip route-static 192.168.1.0 24 12.1.1.1
[r2]ip route-static 192.168.3.0 24 23.1.1.2
[r2]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 15 Routes : 15
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/30 Direct 0 0 D 12.1.1.2 GigabitEthernet
0/0/0
12.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
12.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
23.1.1.0/30 Direct 0 0 D 23.1.1.1 GigabitEthernet
0/0/1
23.1.1.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
23.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Static 60 0 RD 12.1.1.1 GigabitEthernet
0/0/0
192.168.2.0/24 Direct 0 0 D 192.168.2.2 GigabitEthernet
0/0/2
192.168.2.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.2.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/2
192.168.3.0/24 Static 60 0 RD 23.1.1.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
pc3
[r3]ip route-static 192.168.2.0 24 23.1.1.1
[r3]ip route-static 192.168.1.0 24 23.1.1.1
[r3]ip route-static 12.1.1.0 30 23.1.1.1
[r3]display ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: Public
Destinations : 13 Routes : 13
Destination/Mask Proto Pre Cost Flags NextHop Interface
12.1.1.0/30 Static 60 0 RD 23.1.1.1 GigabitEthernet
0/0/0
23.1.1.0/30 Direct 0 0 D 23.1.1.2 GigabitEthernet
0/0/0
23.1.1.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
23.1.1.3/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/0
127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0
127.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
192.168.1.0/24 Static 60 0 RD 23.1.1.1 GigabitEthernet
0/0/0
192.168.2.0/24 Static 60 0 RD 23.1.1.1 GigabitEthernet
0/0/0
192.168.3.0/24 Direct 0 0 D 192.168.3.2 GigabitEthernet
0/0/1
192.168.3.2/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
192.168.3.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0