立即注册 登录
雏鹰部落 返回首页

子杰的个人空间 https://bbs.spoto.net/?131778 [收藏] [复制] [分享] [RSS]

日志

静态路由配置案例

已有 162 次阅读2013-2-6 15:11

 

1     案例配置拓扑          

       

2     IP地址规划

 

Fastethernet0/0

Fastethernet1/0

R1

192.168.12.1/24

N/A

R2

192.168.12.2/24

192.168.23.2/24

R3

192.168.23.3/24

N/A

3     案例配置需求

1.     R1R2R3配置接口ip地址,实现设备互联的通信。

2.     R1配置一条去往R3静态路由条目,以下一跳地址方式将数据发送出去

3.     R3配置一条去往R1默认路由条目,以自己出接口方式将数据发送出去

4     案例配置思路

1)     先配R1R2R3接口地址,实现设备互连通信。

(config)#interface fastEthernet 0/0

(config-if)#ip address x.x.x.x x.x.x.x

2)     R1上配置静态路由条目去往R3   

(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2

(config)#ip route 192.168.23.0 255.255.255.0 fastethernet0/0

3)     R3上配置默认路由条目去往R1

(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.2

(config)#ip route 0.0.0.0 0.0.0.0 fastethernet0/0

5     案例检验结果

1)     先查看R1是否有去往R3的路由条目:

R1#show 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.12.0/24 is directly connected, FastEthernet0/0

S    192.168.23.0/24 [1/0] via 192.168.12.2

/上面显示的S表示去往R3网段的静态路由条目,以下一跳的方式把数据发送出去,且S代表static/

2)     查看R3去往R1的路由条目:

R3#show 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 0.0.0.0 to network 0.0.0.0

 

C    192.168.23.0/24 is directly connected, FastEthernet0/0

S*   0.0.0.0/0 is directly connected, FastEthernet0/0

/上面显示的S*表示的是默认路由条目,且以出接口的方式将数据发送出去/

3)     测试R1R3能否通信:

R1#ping 192.168.23.3

 

Type escape sequence to abort.

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

.!!!!

Success rate is 80 percent (4/5), round-trip min/avg/max = 32/46/60 ms

 

/上面显示能相互通信/

 

6     案例配置文件

R1:

enable
conf t
hostname R1
!
interface FastEthernet0/0
 ip address 192.168.12.1 255.255.255.0
 no shutdown
 exit
!
ip route 192.168.23.0 255.255.255.0 192.168.12.2
!
end

R2:

enable
conf t
hostname R2
!
interface FastEthernet0/0
 ip address 192.168.12.2 255.255.255.0
 no shutdown
 exit
!
interface FastEthernet1/0
 ip address 192.168.23.2 255.255.255.0
 no shutdown
 exit
!
end


R3:

enable
conf t
hostname R3
!
interface FastEthernet0/0
 ip address 192.168.23.3 255.255.255.0
 no shutdown
 exit
!
ip route 0.0.0.0 0.0.0.0 FastEthernet0/0
!
end

7     案例总结及其它

1)静态路由的命令:

ip route x.x.x.x x.x.x.x fastethernet x/x 该接口为自己设备上的出端口

ip route x.x.x.x x.x.x.x x.x.x.x  ,下一跳地址即是在该设备上相连的对端设备接口地址//

2) 路由表中用S显示的就是静态路由,若是S*则表示的是默认路由。

3)默认路由也是包含在静态路由中,是一目的网段为全网的静态路由。

4)静态路由的AD值为1

 
 
 
-----------------------------------------------------------------------------------------
SPOTO 我们共创未来

您的朋友 周俊杰(Jay)
 
Email:zhoujj@spoto.net
新浪微博:http://weibo.com/zhoujj0130
新浪博客:http://blog.sina.com.cn/zhoujj0130
持续付出不亚于任何人的努力
-----------------------------------------------------------------------------------------

路过

雷人

握手

鲜花

鸡蛋

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-5-8 04:04 , Processed in 0.061360 second(s), 18 queries , Gzip On.

返回顶部