静态路由配置

1、 实验目的:

通过本次的实验,我们可以掌握如下技能

1) 理解路由表的概念。

2) Ip route命令的使用。

3) 根据需求,可以正确的配置静态路由。

2、 实验拓扑图:

clip_image002

3、 实验步骤:

(1) 根据拓扑图上各接口地址分配情况,配置各个路由器的接口地址。

R1(config)#

R1(config)#int

R1(config)#interface loo

R1(config)#interface loopback 0

R1(config-if)#ip ad

R1(config-if)#ip address 1.1.1.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#no shutdown

R1(config-if)#exit

R1(config)#in

R1(config)#interface s

R1(config)#interface serial 2/0

R1(config-if)#ip ad

R1(config-if)#ip address 192.168.1.1 255.255.255.252

R1(config-if)#no sh

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to down

R1(config-if)#exit

R1(config)#

R2(config-if)#interface loopback 0

R2(config-if)#ip ad

R2(config-if)#ip address 2.2.2.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#no shutdown

R2(config-if)#exit

R2(config)#int

R2(config)#interface s

R2(config)#interface serial 2/0

R2(config-if)#cl

R2(config-if)#clock r

R2(config-if)#clock rate 128000

R2(config-if)#ip ad

R2(config-if)#ip address 192.168.1.2 255.255.255.252

R2(config-if)#no sh

R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial2/0, changed state to up

R2(config-if)#exit

R2(config)#in

R2(config)#interface s

R2(config)#interface serial 3/0

R2(config-if)#cl

R2(config-if)#clock r

R2(config-if)#clock rate 128000

R2(config-if)#ip ad

R2(config-if)#ip address 192.168.2.1 255.255.255.252

R2(config-if)#no sh

R2(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial3/0, changed state to down

R2(config-if)#exit

R2(config)#

R3(config-if)#interface loopback 0

R3(config-if)#ip ad

R3(config-if)#ip address 3.3.3.3 255.255.255.0

R3(config-if)#no sh

R3(config-if)#no shutdown

R3(config-if)#exit

R3(config)#int

R3(config)#interface s

R3(config)#interface serial 3/0

R3(config-if)#ip ad

R3(config-if)#ip address 192.168.2.2 255.255.255.252

R3(config-if)#no s

R3(config-if)#no sh

R3(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial3/0, changed state to up

R3(config-if)#

(2) 在R1上配置静态路由。

R1(config)#ip route

R1(config)#ip route 3.3.3.0 255.255.255.0 192.168.1.2

R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2

R1(config)#ip route 192.168.2.0 255.255.255.252 192.168.1.2

R1(config)#

(3) 在R2上配置静态路由。

R2(config)#ip ro

R2(config)#ip route 1.1.1.0 255.255.255.0 192.168.1.1

R2(config)#ip ro

R2(config)#ip route 3.3.3.0 255.255.255.0 192.168.2.2

R2(config)#

(4) 在R3上配置静态路由。

R3(config)#ip rou

R3(config)#ip route 1.1.1.0 255.255.255.0 192.168.2.1

R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.1.2

R3(config)#ip route 192.168.1.0 255.255.255.252 192.168.2.1

R3(config)#

4、 实验调试

(1) 在R1、R2、R3上分别查看路由表。

R1#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

1.0.0.0/24 is subnetted, 1 subnets

C 1.1.1.0 is directly connected, Loopback0

3.0.0.0/24 is subnetted, 1 subnets

S 3.3.3.0 [1/0] via 192.168.1.2

192.168.1.0/30 is subnetted, 1 subnets

C 192.168.1.0 is directly connected, Serial2/0

192.168.2.0/30 is subnetted, 1 subnets

S 192.168.2.0 [1/0] via 192.168.1.2

R1#

R2#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

1.0.0.0/24 is subnetted, 1 subnets

S 1.1.1.0 [1/0] via 192.168.1.1

2.0.0.0/24 is subnetted, 1 subnets

C 2.2.2.0 is directly connected, Loopback0

3.0.0.0/24 is subnetted, 1 subnets

S 3.3.3.0 [1/0] via 192.168.2.2

192.168.1.0/30 is subnetted, 1 subnets

C 192.168.1.0 is directly connected, Serial2/0

192.168.2.0/30 is subnetted, 1 subnets

C 192.168.2.0 is directly connected, Serial3/0

R2#

R3#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP

D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default, U - per-user static route, o - ODR

P - periodic downloaded static route

Gateway of last resort is not set

1.0.0.0/24 is subnetted, 1 subnets

S 1.1.1.0 [1/0] via 192.168.2.1

3.0.0.0/24 is subnetted, 1 subnets

C 3.3.3.0 is directly connected, Loopback0

192.168.1.0/30 is subnetted, 1 subnets

S 192.168.1.0 [1/0] via 192.168.2.1

192.168.2.0/30 is subnetted, 1 subnets

C 192.168.2.0 is directly connected, Serial3/0

R3#

(2) 从个路由器的环回口ping其他路由器的环回口。

R1#ping 2.2.2.2

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 16/28/32 ms

R1#ping 3.3.3.3

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 62/62/63 ms

R2#ping 1.1.1.1

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 31/31/32 ms

R2#ping 3.3.3.3

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 17/28/31 ms

R2#

R3#ping 1.1.1.1

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 49/60/63 ms

R3#ping 2.2.2.2

Type escape sequence to abort.

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

!!!!!

Success rate is 100 percent (5/5), round-trip min/avg/max = 19/28/31 ms

R3#

OK 出现!!!!!表明都可以通信了,到此实验结束!!!!!!!