环境:两台2500系列路由器通过串口相连。
要求:在R1和R2上启用静态路由,使两端网络能够互通。
步骤一、基本配置
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