这次的静态路由实验虽然简单,但有些地方还是要仔细的搞明白才好.
比如说在R1的上配置表态路由的话,它的目标地址为什么不是IP地址而是一个子网地址呢?下一跳地址是S1/0(192.168.2.1)行不行呢?一定要用R2的S1/0(192.168.2.2)作为一下跳地址吗?这些都是值得去思考的问题!
实验拓扑图如下:
过程描述:
R1
的配置
:
先配置好路由器的接口
IP
地址
Router>en
Router#
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1
R1(config)#int e0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int s1/0
R1(config-if)#
*Mar 1 00:03:31.311: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:03:32.367: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to up
R1(config-if)#int s1/0
R1(config-if)#ip add 192.168.2.1 255.255.255.0
R1(config-if)#no shut
查看该端口是否
DCE
端
,
是的话就配置线路速率为
64000
R1(config-if)#do show controllers s1/0
M4T: show controller:
PAS unit 0, subunit 0, f/w version 1-45, rev ID 0x2800001, version 1
idb = 0x63657214, ds = 0x 636589A 4, ssb=0x63658D58
Clock mux=0x0, ucmd_ctrl=0x 1C , port_status=0x7B
Serial config=0x8, line config=0x200
maxdgram=1608, bufpool=78Kb, 120 particles
DCD=up DSR=up DTR=up RTS=up CTS=up
line state: up
cable type : V.11 (X.21) DCE cable, received clockrate 2015232
base0 registers=0x 3C 800000, base1 registers=0x 3C 802000
mxt_ds=0x6365E468, rx ring entries=78, tx ring entries=128
rxring=0x5D 3F 0A 0, rxr shadow=0x 6365F 39C , rx_head=0
txring=0x5D 3F 340, txr shadow=0x 6365F 770, tx_head=3, tx_tail=3, tx_count=0
throttled=0, enabled=0
halted=0, last halt reason=0
Microcode fatal errors=0
rx_no_eop_err=0, rx_no_stp_err=0, rx_no_eop_stp_err=0
rx_no_buf=0, rx_soft_overrun_err=0, dump_err= 0, bogus=0, mxt_flags=0x0
tx_underrun_err=0, tx_soft_underrun_err=0, tx_limited=0(2)
tx_fullring=0, tx_started=30, mxt_flush_count=0
rx_int_count=14, tx_int_count=40
R1(config-if)#
查看各接口的状态
R1#show ip int brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.1.1 YES manual up up
Serial1/0 192.168.2.1 YES manual up down
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
因为
S1/0
的端口的
protocal
的状态为
down,
将该接口设为
no keepalive.
再查看
.这个方法我也是参照网上的朋友说的,为什么要这样我也还没怎么明白.
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#int s1/0
R1(config-if)#no keepalive
R1(config-if)#do show ip int brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.1.1 YES manual up up
Serial1/0 192.168.2.1 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
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.1.0/24 is directly connected, Ethernet0/0
C 192.168.2.0/24 is directly connected, Serial1/0
R1#
至些
,R1
的基本配置已经完成
.
同样地
,
先配置好
R2
的基本配置
R2
的配置
:
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int e0/0
R2(config-if)#ip add 192.168.3.1 255.255.255.0
R2(config-if)#no shut
R2(config-if)#int s1/0
R2(config-if)#
*Mar 1 00:06:57.995: %LINK-3-UPDOWN: Interface Ethernet0/0, changed state to up
*Mar 1 00:06:59.047: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0/0, changed state to upip
% Incomplete command.
R2(config-if)#int s1/0
R2(config-if)#ip add 192.168.2.2 255.255.255.0
R2(config-if)#no shut
R2(config-if)#no kee
*Mar 1 00:07:17.327: %LINK-3-UPDOWN: Interface Serial1/0, changed state to up
*Mar 1 00:07:18.327: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/0, changed state to up
R2(config-if)#no keepalive
R2(config-if)#do sh ip int brief
Interface IP-Address OK? Method Status Protocol
Ethernet0/0 192.168.3.1 YES manual up up
Serial1/0 192.168.2.2 YES manual up up
Serial1/1 unassigned YES unset administratively down down
Serial1/2 unassigned YES unset administratively down down
Serial1/3 unassigned YES unset administratively down down
R2(config-if)#
R2#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.2.0/24 is directly connected, Serial1/0
C 192.168.3.0/24 is directly connected, Ethernet0/0
R2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 248/337/576 ms
R2#
好了
,
到这里
,
已经配置好
R1
和
R2
的物理连接了
.
R1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
但是从
R1
真的可以
ping
通到
R2
的
e0/0(192.168.3.1)
吗
?
R1#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
要让
R1
的数据包流通到
R2
的
e0/0,
就要设置静态路由了
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2 (
重点要记住静态路由的命令格式
)
R1(config)#^Z
R1#sh
*Mar 1 00:08:42.403: %SYS-5-CONFIG_I: Configured from console by cons
R1#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
R1#ping 192.168.3.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.3.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 284/287/288 ms
R2
的配置其实跟
R1
是差不多的
.
R2
的配置
:
R2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 248/337/576 ms
R2#ping 192.168.1.1
(
一样是
ping
不通的
,
要设置静态路由才能
ping
得通
.)
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#^Z
R2#copy
*Mar 1 00:10:28.143: %SYS-5-CONFIG_I: Configured from console by consolerum
% Incomplete command.
R2#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 284/287/288 ms
R2#
R2#ping 192.168.2.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 248/337/576 ms
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#^Z
R2#copy
*Mar 1 00:10:28.143: %SYS-5-CONFIG_I: Configured from console by consolerum
% Incomplete command.
R2#copy run start
Destination filename [startup-config]?
Building configuration...
[OK]
R2#ping 192.168.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 284/287/288 ms
R2#
本文出自 “ 孤帆远影碧空尽” 博客,请务必保留此出处 [url]http://bennie.blog.51cto.com/192876/99247[/url]
本文出自 51CTO.COM技术博客