配置R1的路由R1#conftEnte"/>

CISCO的静态路由配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CISCO的静态路由配置相关的知识,希望对你有一定的参考价值。

三台路由器和两台PC机




技术分享

配置R1的路由

R1#conf t

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

R1(config)#int e0/0

R1(config-if)#ip add

R1(config-if)#ip address 192.168.20.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#int e0

*Mar  1 00:03:37.803: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:03:38.803: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

R1(config-if)#int e0/1

R1(config-if)#ip add

R1(config-if)#ip address 192.168.10.1 255.255.255.0

R1(config-if)#no sh

R1(config-if)#

*Mar  1 00:03:57.123: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:03:58.123: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

R1(config-if)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.20.1    YES manual up                    up

Ethernet0/1                192.168.10.1    YES manual up                    up

Ethernet0/2                unassigned      YES unset  administratively down down

Ethernet0/3                unassigned      YES unset  administratively down down

R1(config-if)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


C    192.168.10.0/24 is directly connected, Ethernet0/1

C    192.168.20.0/24 is directly connected, Ethernet0/0

R1(config-if)#

R1#conf t

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

R1(config)#ip route 192.168.30.0 255.255.255.0 192.168.20.2

R1(config)#ip route 192.168.40.0 255.255.255.0 192.168.30.2

R1(config)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


S    192.168.30.0/24 [1/0] via 192.168.20.2

C    192.168.10.0/24 is directly connected, Ethernet0/1

S    192.168.40.0/24 [1/0] via 192.168.30.2

C    192.168.20.0/24 is directly connected, Ethernet0/0


配置R2的路由

R2#conf t

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

R2(config)#int

R2(config)#int e0/0

R2(config-if)#ip add

R2(config-if)#ip address 192.168.20.2 255.255.255.0

R2(config-if)#no sh

R2(config-if)#int e0/1

R2(config-if)#

*Mar  1 00:29:15.435: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:29:16.435: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

R2(config-if)#ip add

R2(config-if)#ip address 192.168.30.1 255.255.255.0

R2(config-if)#no sh

R2(config-if)#do sh ip ro

*Mar  1 00:29:27.283: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:29:28.283: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

R2(config-if)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


C    192.168.30.0/24 is directly connected, Ethernet0/1

C    192.168.20.0/24 is directly connected, Ethernet0/0

R2(config-if)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.20.2    YES manual up                    up

Ethernet0/1                192.168.30.1    YES manual up                    up

Ethernet0/2                unassigned      YES unset  administratively down down

Ethernet0/3                unassigned      YES unset  administratively down down

R2(config-if)#

R2#en

R2#conf t

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

R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1

R2(config)#ip route 192.168.40.0 255.255.255.0 192.168.30.2

R2(config)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


C    192.168.30.0/24 is directly connected, Ethernet0/1

S    192.168.10.0/24 [1/0] via 192.168.20.1

S    192.168.40.0/24 [1/0] via 192.168.30.2

C    192.168.20.0/24 is directly connected, Ethernet0/0

R2(config)#

配置R3的路由

R3#conf t

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

R3(config)#int g

R3(config)#int e0/0

R3(config-if)#ip add

R3(config-if)#ip address 192.168.30.2 255.255.255.0

R3(config-if)#no sh

R3(config-if)#int e0/1

R3(config-if)#

*Mar  1 00:32:14.107: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up

*Mar  1 00:32:15.107: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up

R3(config-if)#ip add

R3(config-if)#ip address 192.168.40.1 255.255.255.0

R3(config-if)#no sh

R3(config-if)#do sh ip ro

*Mar  1 00:32:29.031: %LINK-3-UPDOWN: Interface Ethernet0/1, changed state to up

*Mar  1 00:32:30.031: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/1, changed state to up

R3(config-if)#do sh ip int br

Interface                  IP-Address      OK? Method Status                Protocol

Ethernet0/0                192.168.30.2    YES manual up                    up

Ethernet0/1                192.168.40.1    YES manual up                    up

Ethernet0/2                unassigned      YES unset  administratively down down

Ethernet0/3                unassigned      YES unset  administratively down down

R3(config-if)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


C    192.168.30.0/24 is directly connected, Ethernet0/0

C    192.168.40.0/24 is directly connected, Ethernet0/1

R3(config-if)#

R3#conf t

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

R3(config)#ip route 192.168.20.0 255.255.255.0 192.168.30.1

R3(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1

R3(config)#do sh ip route

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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


C    192.168.30.0/24 is directly connected, Ethernet0/0

S    192.168.10.0/24 [1/0] via 192.168.20.1

C    192.168.40.0/24 is directly connected, Ethernet0/1

S    192.168.20.0/24 [1/0] via 192.168.30.1

R3(config)#

配置PC机的IP地址和ping

技术分享

能Ping通就说明配置没问题

本文出自 “DY” 博客,请务必保留此出处http://guochenyong.blog.51cto.com/11367898/1971540

以上是关于CISCO的静态路由配置的主要内容,如果未能解决你的问题,请参考以下文章

配置Cisco 路由器的静态路由

cisco静态路由

Cisco PT模拟实验(12) 路由器静态路由的配置

Cisco设备;静态路由;DHCP的基础配置

CISCO的静态路由配置

cisco Switching-三层交换配置RIP动态路由