网络拓扑规划:
实验目的:运用静态路由配置,通过下一跳地址达到两台PC访问目的。
概念解释:
1、路由器的作用
路由器的核心作用是实现网络互连,数据转发,路由器工作时需要建立和更新路由表,因为路由器互联的是不同网段,因此能隔离广播,能快速转发分组数据。
2、路由表
路由表,简单说来就是指挥数据如何发送到目的地的表,这里不过多赘述。
实验开始:
1、首先配置两台pc的ip、子网、网关。如下图:
2、配置两台路由器接口IP
R1
[R1]INT G0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.10.2 24
[R1-GigabitEthernet0/0/0]q
[R1]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.20.1 24
[R1-GigabitEthernet0/0/1]q
R2
[R2]int g0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.30.1 24
[R2-GigabitEthernet0/0/1]q
[R2]int g0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.20.2 24
[R2-GigabitEthernet0/0/0]q
3、分别配置R1、R2的下一跳地址
[R1]ip route-static 192.168.30.0 24 192.168.20.2
[R2]ip route-static 192.168.10.0 24 192.168.20.1
4、查看路由表,看地址是否存在
[R1]disp ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface192.168.30.0/24 Static 60 0 RD 192.168.20.2 GigabitEthernet
0/0/1
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
[R2]disp ip routing-table
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: PublicDestinations : 11 Routes : 11 Destination/Mask Proto Pre Cost Flags NextHop Interface127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0127.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 InLoopBack0192.168.10.0/24 Static 60 0 RD 192.168.20.1 GigabitEthernet
0/0/0255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
路由表都没问题
5、最后开PC是否互通
pc1→pc2
PC>ping 192.168.30.2Ping 192.168.30.2: 32 data bytes, Press Ctrl_C to break
Request timeout!
Request timeout!
From 192.168.30.2: bytes=32 seq=3 ttl=126 time=16 ms
From 192.168.30.2: bytes=32 seq=4 ttl=126 time=31 ms
From 192.168.30.2: bytes=32 seq=5 ttl=126 time=16 ms--- 192.168.30.2 ping statistics ---5 packet(s) transmitted3 packet(s) received40.00% packet lossround-trip min/avg/max = 0/21/31 ms
pc2→pc1
PC>ping 192.168.10.1Ping 192.168.10.1: 32 data bytes, Press Ctrl_C to break
From 192.168.10.1: bytes=32 seq=1 ttl=126 time=16 ms
From 192.168.10.1: bytes=32 seq=2 ttl=126 time=15 ms
From 192.168.10.1: bytes=32 seq=3 ttl=126 time=31 ms
From 192.168.10.1: bytes=32 seq=4 ttl=126 time=16 ms
From 192.168.10.1: bytes=32 seq=5 ttl=126 time=31 ms--- 192.168.10.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 15/21/31 ms
互通正常,静态路由配置成功。
总结:
在静态路由配置过程中,要准确识别目的网段对应的下一跳IP地址,如果判断错误,目的地址不可达;要善于查看路由表,检验静态路由配置是否正确。