分析:
1.在每台路由器上配置ip地址
2.创建环回
3.R1,R3启用dhcp下放
4.启用ripv2宣告全网实现全网可达
配置:
R1:
[Huawei]sysname r1
[r1]interface g0/0/0
[r1-GigabitEthernet0/0/0]ip address 12.1.1.1 24
[r1]interface g0/0/1
[r1-GigabitEthernet0/0/1]ip address 192.168.1.1 24 //配置ip地址
[r1]dhcp enable
[r1]ip pool aa
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.1.1
[r1-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[r1-GigabitEthernet0/0/1]dhcp select global //dhcp启用下放ip
[r1]interface LoopBack 0
[r1-LoopBack0]ip address 1.1.1.1 32 //创建环回
[r1]rip 1
[r1-rip-1]version 2 //选择v2版本
[r1-rip-1]network 1.0.0.0
[r1-rip-1]network 192.168.1.0
[r1-rip-1]network 12.0.0.0 //rip宣告
[r1]display ip routing-table protocol rip //查看rip路由表
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 4 Routes : 4
RIP routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
2.2.2.2/32 RIP 100 1 D 12.1.1.2 GigabitEthernet
0/0/0
3.3.3.3/32 RIP 100 2 D 12.1.1.2 GigabitEthernet
0/0/0
23.1.1.0/24 RIP 100 1 D 12.1.1.2 GigabitEthernet
0/0/0
192.168.2.0/24 RIP 100 2 D 12.1.1.2 GigabitEthernet
0/0/0
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
R2:
[Huawei]sysname r2
[r2]interface g0/0/0
[r2-GigabitEthernet0/0/0]ip address 12.1.1.2 24
[r2]interface g0/0/1
[r2-GigabitEthernet0/0/1]ip address 23.1.1.1 24 //配置ip地址
[r2]interface LoopBack 0
[r2-LoopBack0]ip address 2.2.2.2 32 //创建环回
[r2]rip 1
[r2-rip-1]version 2 //选择v2版本
[r2-rip-1]network 12.0.0.0
[r2-rip-1]network 2.0.0.0
[r2-rip-1]network 23.0.0.0 //RIP宣告
<r2>display ip routing-table protocol rip //查看rip路由表
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 4 Routes : 4
RIP routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 1 D 12.1.1.1 GigabitEthernet
0/0/0
3.3.3.3/32 RIP 100 1 D 23.1.1.2 GigabitEthernet
0/0/1
192.168.1.0/24 RIP 100 1 D 12.1.1.1 GigabitEthernet
0/0/0
192.168.2.0/24 RIP 100 1 D 23.1.1.2 GigabitEthernet
0/0/1
RIP routing table status : <Inactive>
Destinations : 0 Routes : 0
R3:
[Huawei]interface g0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 23.1.1.2 24
[Huawei]interface g0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.2.1 24 //配置ip地址
[Huawei]dhcp enable
[Huawei]sysname r3
[r3]ip pool aa
[r3-ip-pool-aa]network 192.168.2.0 mask 24
[r3-ip-pool-aa]gateway-list 192.168.2.1
[r3-ip-pool-aa]dns-list 8.8.8.8 114.114.114.114
[r3]interface g0/0/1
[r3-GigabitEthernet0/0/1]dhcp select global //dhcp下放
[r3]interface LoopBack 0
[r3-LoopBack0]ip address 3.3.3.3 32 //创建环回
[r3]rip 1
[r3-rip-1]version 2 //选择v2版本
[r3-rip-1]network 3.0.0.0
[r3-rip-1]network 23.0.0.0
[r3-rip-1]network 192.168.2.0 //rip宣告
<r3>display ip routing-table protocol rip //查看路由表
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Public routing table : RIP
Destinations : 4 Routes : 4
RIP routing table status : <Active>
Destinations : 4 Routes : 4
Destination/Mask Proto Pre Cost Flags NextHop Interface
1.1.1.1/32 RIP 100 2 D 23.1.1.1 GigabitEthernet
0/0/0
2.2.2.2/32 RIP 100 1 D 23.1.1.1 GigabitEthernet
0/0/0
12.1.1.0/24 RIP 100 1 D 23.1.1.1 GigabitEthernet
0/0/0
192.168.1.0/24 RIP 100 2 D 23.1.1.1 GigabitEthernet
0/0/0
结果: PC1 ping PC4 实现了全网可达
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:feee:5a6
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.254
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.1
Physical address..................: 54-89-98-EE-05-A6
DNS server........................: 8.8.8.8
114.114.114.114
PC>ping 192.168.2.253
Ping 192.168.2.253: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.253: bytes=32 seq=2 ttl=125 time=78 ms
From 192.168.2.253: bytes=32 seq=3 ttl=125 time=63 ms
From 192.168.2.253: bytes=32 seq=4 ttl=125 time=78 ms
From 192.168.2.253: bytes=32 seq=5 ttl=125 time=78 ms
--- 192.168.2.253 ping statistics ---
5 packet(s) transmitted
4 packet(s) received
20.00% packet loss
round-trip min/avg/max = 0/74/78 ms