Chinaunix首页 | 论坛 | 博客
  • 博客访问: 565139
  • 博文数量: 88
  • 博客积分: 7206
  • 博客等级: 少将
  • 技术积分: 1162
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-26 16:04
文章分类

全部博文(88)

文章存档

2011年(3)

2010年(24)

2009年(16)

2008年(45)

分类:

2009-05-15 11:08:23

环境:两台2500系列路由器通过串口相连。

  要求:在R1R2上启用静态路由,使两端网络能够互通。

 

 

步骤一、基本配置

 

Router>

Router>enable

Router#config terminal

Router(config)#hostname R1

R1(config)#no ip domain-lookup  

R1(config)#line console 0

R1(config-line)# logging synchronous

R1(config-line)#exec-timeout 0 0 

R1(config-line)#exit

 

步骤二:接口配置

 

R1的配置:

R1(config)#interface s0

R1(config-if)#ip address 30.1.1.1 255.255.255.0

R1(config-if)#clock rate 64000     à时钟速率端

R1(config-if)#no shutdown

R1(config-if)#interface loopback 0

R1(config-if)#ip address 10.1.1.1 255.255.255.0

R1(config-if)#

 

R2的配置:

Router(config)#hostname R2

R2(config)#interface s1

R2(config-if)#ip address 30.1.1.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#interface loopback 0

R2(config-if)#ip address 20.1.1.1 255.255.255.0

R2(config-if)#exit

R2(config)#

 

步骤三、指定静态路由

R1(config)#

R1(config)#ip route 20.1.1.0 255.255.255.0 serial 0   à指定静态路由

R2(config)#

R2(config)#ip route 10.1.1.0 255.255.255.0 30.1.1.1   à指定静态路由

 

步骤四、作ping 测试

R1#ping

Protocol [ip]:

Target IP address: 20.1.1.1           à目的地址

Extended commands [n]: y           à是否用扩展命令

Source address or interface: 10.1.1.1   à源地址

!!!!!             à显示已通

 

步骤五、显示静态路由条目

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

 

     20.0.0.0/24 is subnetted, 1 subnets

S       20.1.1.0 is directly connected, Serial0        à静态路由条目

     10.0.0.0/24 is subnetted, 1 subnets

C       10.1.1.0 is directly connected, Loopback0

     30.0.0.0/24 is subnetted, 1 subnets

C       30.1.1.0 is directly connected, Serial0

 

 

步骤六、显示当前配置

 

R1的配置结果:

R1#show running-config

!

hostname R1

!

no ip domain-lookup

!

interface Loopback0

 ip address 10.1.1.1 255.255.255.0

!

interface Serial0

 ip address 30.1.1.1 255.255.255.0

 clockrate 64000

!

ip route 20.1.1.0 255.255.255.0 Serial0

!

line con 0

 exec-timeout 0 0

 logging synchronous

 transport input none

end

 

R2的配置结果:

R2#show running-config

!

hostname R2

!

no ip domain-lookup

!

interface Loopback0

 ip address 20.1.1.1 255.255.255.0

!

interface Serial1

 ip address 30.1.1.2 255.255.255.0

!

ip route 10.1.1.0 255.255.255.0 30.1.1.1

!

line con 0

 exec-timeout 0 0

 logging synchronous

!

end

 

总结:随着网络的不断庞大,静态路由只在网络末梢及特殊设置时才会使用~!

          还有就是在配置接口时尽量使用下一跳的IP地址或者是接口及IP地址,不要只使用接口,否则会产生大量的无用数据流量~!

阅读(826) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~