实验环境:

wKioL1kb-NrzfrI3AABc6DLHHQc278.jpg-wh_50

实验要求:需要在三台路由器上配置静态路由,以实现各网段之间的互通。

     R1Loopback 0配置192.168.10.1/24

     R1F0/0接口配置192.168.1.1/24

     R1F0/1接口配置192.168.2.1/24

R2Loopback 0配置192.168.20.1/24

     R2F0/0接口配置192.168.3.2/24

R2F0/1接口配置192.168.1.2/24

R3Loopback 0配置192.168.30.1/24

R3F0/0接口配置192.168.2.3/24

R3F0/1接口配置192.168.3.3/24

实验过程:

1.    配置R1各接口IP地址

R1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#int lo

R1(config)#int loopback 0

R1(config-if)#ip add 192.168.10.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int f0/0

R1(config-if)#ip add 192.168.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int f0/1

R1(config-if)#ip add 192.168.2.1 255.255.255.0

R1(config-if)#no sh

wKiom1kb-NrCV1LhAABNoypXwCw948.jpg-wh_50

检查R1各接口IP地址是否正确

R1#show ip interface B

Interface     IP-Address  OK? Method Status           Protocol

FastEthernet0/0  192.168.1.1     YES manual up            up

FastEthernet0/1  192.168.2.1     YES manual up            up

Loopback0       192.168.10.1    YES manual up           up

wKiom1kb-NrB2UwXAAArbQbgXLY955.jpg-wh_50

2.    配置R2各接口IP地址

R2#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R2(config)#int lo

R2(config)#int loopback 0

R2(config-if)#ip add 192.168.20.1 255.255.255.0

R2(config-if)#no sh

R2(config-if)#int f0/0

R2(config-if)#ip add 192.168.3.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#int f0/1

R2(config-if)#ip add 192.168.1.2 255.255.255.0

R2(config-if)#no sh

wKioL1kb-NuAy1RrAABFYs5nIsI455.jpg-wh_50

检查R2各接口IP地址是否正确

R2#show ip interface B

Interface       IP-Address      OK?Method Status      Protocol

FastEthernet0/0  192.168.3.2     YES manual up           up

FastEthernet0/1  192.168.1.2     YES manual up           up

Loopback0       192.168.20.1    YES manual up           up

wKiom1kb-NvD-kBnAAAq8ZvNAao199.jpg-wh_50

3.    配置R3各接口IP地址

R3#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R3(config)#int lo

R3(config)#int loopback 0

R3(config-if)#ip add 192.168.30.1 255.255.255.0

R3(config-if)#no sh

R3(config-if)#int f0/0

R3(config-if)#ip add 192.168.2.3 255.255.255.0

R3(config-if)#no sh

R3(config-if)#int f0/1

R3(config-if)#ip add 192.168.3.3 255.255.255.0

R3(config-if)#no sh

wKioL1kb-NvDlJ_EAABHByAISEU595.jpg-wh_50

检查R3各接口IP地址是否正确

R3#show ip interface B

Interface       IP-Address      OK? MethodStatus      Protocol

FastEthernet0/0  192.168.2.3     YES manual up             up

FastEthernet0/1  192.168.3.3     YES manual up             up

Loopback0       192.168.30.1    YESmanual up             up

wKiom1kb-Nyj__vOAAAqYSRpbSM440.jpg-wh_50

4.    在R1上配置静态路由

R1#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R1(config)#ip route 192.168.20.0 255.255.255.0192.168.1.2

R1(config)#ip route 192.168.3.0 255.255.255.0192.168.1.2

R1(config)#ip route 192.168.30.0 255.255.255.0192.168.1.2

wKioL1kb-NzyYTgVAAAkd2ek9zw071.jpg-wh_50

5.在R2上配置静态路由

R2#conf t

Enterconfiguration commands, one per line. End with CNTL/Z

R2(config)#iproute 192.168.30.0 255.255.255.0 192.168.3.3

R2(config)#iproute 192.168.2.0 255.255.255.0 192.168.3.3

R2(config)#iproute 192.168.10.0 255.255.255.0 192.168.3.3

wKioL1kb-NzwTHTcAAAlQ5Rl_wo138.jpg-wh_50

6.    在R3上配置静态路由

R3#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R3(config)#ip route 192.168.10.0 255.255.255.0192.168.2.1

R3(config)#ip route 192.168.1.0 255.255.255.0192.168.2.1

R3(config)#ip route 192.168.20.0 255.255.255.0192.168.2.1

wKiom1kb-NyjJFoyAAAfWdDuJZs414.jpg-wh_50

6.进行ping通测试,测试个网段是否互通

   R1#ping192.168.30.1

 

Type escapesequence to abort.

Sending 5,100-byte ICMP Echos to 192.168.30.1, timeout is 2 seconds:

!!!!!

Success rate is100 percent (5/5), round-trip min/avg/max = 44/64/100 ms

R1#ping192.168.20.1

 

Type escapesequence to abort.

Sending 5,100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:

!!!!!

Success rate is100 percent (5/5), round-trip min/avg/max = 28/56/68 ms

wKiom1kb-N3CyPkgAABIOs0Dt2g657.jpg-wh_50

R2#ping192.168.10.1

 

Type escapesequence to abort.

Sending 5,100-byte ICMP Echos to 192.168.10.1, timeout is 2 seconds:

!!!!!

Success rate is100 percent (5/5), round-trip min/avg/max = 28/58/96 ms

R2#ping 192.168.20.1

 

Type escapesequence to abort.

Sending 5,100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:

!!!!!

Success rate is100 percent (5/5), round-trip min/avg/max = 1/2/4 ms

wKioL1kb-N2Qj97kAABSZ07_KTs387.jpg-wh_50

R3#ping192.168.10.1

 

Type escapesequence to abort.

Sending 5, 100-byteICMP Echos to 192.168.10.1, timeout is 2 seconds:

.!!!!

Success rate is80 percent (4/5), round-trip min/avg/max = 44/67/96 ms

R3#ping192.168.20.1

 

Type escapesequence to abort.

Sending 5,100-byte ICMP Echos to 192.168.20.1, timeout is 2 seconds:

..!!!

Success rate is60 percent (3/5), round-trip min/avg/max = 52/89/116 ms

wKiom1kb-N3h_5mdAABBtkg1eWY071.jpg-wh_50

实验总结:路由器在对非直连网段就需要通过静态路由指定路由条目,路由器转发数据是根据数据包中的目标地址所对应的条目。静态路由是设置是根据目标网段和下一跳接口组成。