网络工程师交换试验手册之二:静态路由实验
实验目的: 本文出自 51CTO.COM技术博客 理解路由的在数据传输过程中的作用。 通过该实验学会配置静态路由,并通过ping命令体会静态路由的效果。 掌握ping命令的使用。 实验拓扑: (2台路由与3台路由环境)实验内容: 2台路由器静态路由协议的基本配置 首先将所有的路由器起名称,并且将所有的链路层调试通 Router> Router> en Router#conf t Enter configuration commands, one per line. End with CNTL/Z. Router(config)#host r1 起名称 r1(config)#int e0 进e0端口 r1(config-if)#ip add 199.99.1.1 255.255.255.0 配置IP地址 r1(config-if)#no shut r1(config-if)#int s0 r1(config-if)#ip add 199.99.2.1 255.255.255.0 00:43:00: %LINK-3-UPDOWN: Interface Ethernet0, changed state to up 00:43:01: %LINEPROTO-5-UPDOWN: Line protocol on Interface Ethernet0, changed state to up 系统状态提示接口双UP r1(config-if)#^Z r1#sh contr r1#sh controllers s 0 查看R1的s0口是否为DCE HD unit 0, idb = 0x16DFD8, driver structure at 0x175B00 buffer size 1524 HD unit 0, V.35 DTE cable cpb = 0xE1, eda = 0x5140, cda = 0x5000 RX ring with 16 entries at 0xE15000 00 bd_ptr=0x5000 pak=0x177400 ds=0xE18908 status=80 pak_size=0 01 bd_ptr=0x5014 pak=0x1776D4 ds=0xE18FC4 status=80 pak_size=0 02 bd_ptr=0x5028 pak=0x1779A8 ds=0xE19680 status=80 pak_size=0 03 bd_ptr=0x503C pak=0x177C7C ds=0xE19D3C status=80 pak_size=0 04 bd_ptr=0x5050 pak=0x177F50 ds=0xE1A3F8 status=80 pak_size=0 05 bd_ptr=0x5064 pak=0x178224 ds=0xE1AAB4 status=80 pak_size=0 06 bd_ptr=0x5078 pak=0x1784F8 ds=0xE1B170 status=80 pak_size=0 07 bd_ptr=0x508C pak=0x1787CC ds=0xE1B82C status=80 pak_size=0 08 bd_ptr=0x50A0 pak=0x178AA0 ds=0xE1BEE8 status=80 pak_size=0 09 bd_ptr=0x50B4 pak=0x178D74 ds=0xE1C5A4 status=80 pak_size=0 10 bd_ptr=0x50C8 pak=0x179048 ds=0xE1CC60 status=80 pak_size=0 11 bd_ptr=0x50DC pak=0x17931C ds=0xE1D31C status=80 pak_size=0 12 bd_ptr=0x50F0 pak=0x1795F0 ds=0xE1D9D8 status=80 pak_size=0 13 bd_ptr=0x5104 pak=0x1798C4 ds=0xE1E094 status=80 pak_size=0 14 bd_ptr=0x5118 pak=0x179B98 ds=0xE1E750 status=80 pak_size=0 15 bd_ptr=0x512C pak=0x179E6C ds=0xE1EE0C status=80 pak_size=0 16 bd_ptr=0x5140 pak=0x17A140 ds=0xE1F4C8 status=80 pak_size=0 cpb = 0xE1, eda = 0x5800, cda = 0x5814 TX ring with 1 entries at 0xE15800 bd_ptr=0x5800 pak=0x000000 ds=0xE0124C status=80 pak_size=22 01 bd_ptr=0x5814 pak=0x11EDA8 ds=0xE015DC status=80 pak_size=22 0 missed datagrams, 0 overruns 0 bad datagram encapsulations, 0 memory errors 0 transmitter underruns 0 residual bit errors r1#conf t r1(config)#int s0 到目前为止R1的链路操作完毕 Router>en Router#contf t Router(config)#host r2 r2(config)# r2(config)#int s0 r2(config-if)#ip add 199.99.2.2 255.255.255.0 r2(config-if)#clock rate 64000 进行时钟速率的配置 r2(config-if)#no shut r2(config-if)#ine 0 r2(config-if)#ip add 199.99.3.1 255.255.255.0 r2(config-if)#^Z r2# ping 199.99.2.1 测试直连链路接口是否可以通信 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 199.99.2.1, timeout is 2 seconds: !!!!! Success rate is 100 percent (5/5), round-trip min/avg/max = 32/32/32 ms r2# R2的链路配置完毕 r1#sh 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, 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 199.99.2.0/24 is directly connected, Serial0 C 199.99.1.0/24 is directly connected, Ethernet0 r1# 00:44:33: %SYS-5-CONFIG_I: Configured from console by console r1#sh ip int bri Interface IP-Address OK? Method Status Protocol Ethernet0 199.99.1.1 YES manual up up Serial0 199.99.2.1 YES manual up up Serial1 unassigned YES unset administratively down down r1(config)#ip route 199.99.3.0 255.255.255.0 199.99.2.2 定义路由 r1(config)#^Z r1#ping 199.99.3.1 Sending 5, 100-byte ICMP Echos to 199.99.3.1, timeout is 2 seconds: !!!!! 可以通信 Success rate is 100 percent (5/5), round-trip min/avg/max = 32/34/44 ms 我们还需要里同扩展Ping去测试是否真的R1的E0口的数据包可以到达R2口E0。 r1#ping Protocol [ip]: Target IP address: 199.99.3.1 定义目的 Repeat count [5]: Datagram size [100]: Timeout in seconds [2]: Extended commands [n]: y Source address or interface: 199.99.1.1 定义源 Type of service [0]: Set DF bit in IP header? [no]: Validate reply data? [no]: Data pattern [0xABCD]: Loose, Strict, Record, Timestamp, Verbose[none]: Sweep range of sizes [n]: Packet sent with a source address of 199.99.1.1 ..... r2#conf t r2(config)#ip route 0.0.0.0 0.0.0.0 199.99.2.1 定义到所有地方去的路由的 包下一跳都是199.99.2.1 r2(config)#? r1#ping 再次进行扩展ping的测试 Target IP address: 199.99.3.1 Source address or interface: 199.99.1.1 那么两台路由器的路由实验完全成功了。 r1#sh run Building configuration... Current configuration : 429 bytes ! version 12.2 service timestamps debug uptime service timestamps log uptime no service password-encryption hostname r1 ip subnet-zero interface Ethernet0 ip address 199.99.1.1 255.255.255.0 interface Serial0 ip address 199.99.2.1 255.255.255.0 interface Serial1 no ip address shutdown ip http server ip classless ip route 199.99.3.0 255.255.255.0 199.99.2.2 line con 0 line aux 0 line vty 0 4 end r2#sh run Configured from console by console Current configuration : 437 bytes hostname r2 ip address 199.99.3.1 255.255.255.0 ip address 199.99.2.2 255.255.255.0 clockrate 64000 no ip address ip route 0.0.0.0 0.0.0.0 199.99.2.1 S 199.99.3.0/24 [1/0] via 199.99.2.2 r2#sh ip route D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area Gateway of last resort is 199.99.2.1 to network 0.0.0.0 C 199.99.3.0/24 is directly connected, Ethernet0 S* 0.0.0.0/0 [1/0] via 199.99.2.1 3台路由器静态路由协议的基本配置 Current configuration : 474 bytes ip route 199.99.3.0 255.255.255.0 199.99.2.2 到R2去的路由 ip route 199.99.4.0 255.255.255.0 199.99.2.2 到R3去的路由 Current configuration : 499 bytes ip route 0.0.0.0 0.0.0.0 199.99.2.1 到R1的返回路由 ip route 199.99.4.0 255.255.255.0 199.99.3.2 到R3的路由 r3#sh run Current configuration : 420 bytes hostname r3 ip address 199.99.4.1 255.255.255.0 ip address 199.99.3.2 255.255.255.0 ip route 0.0.0.0 0.0.0.0 199.99.3.1 只有一条返回路由就可以了。 r3# S 199.99.4.0/24 [1/0] via 199.99.2.2 C 199.99.3.0/24 is directly connected, Serial1 S 199.99.4.0/24 [1/0] via 199.99.3.2 r3#sh ip route Gateway of last resort is 199.99.3.1 to network 0.0.0.0 C 199.99.4.0/24 is directly connected, Ethernet0 S* 0.0.0.0/0 [1/0] via 199.99.3.1 实验总结: 静态路由使我们开始学习路由方面的第一步它也是我们经常用到的一种配置路由的方法,是我们以后学习其他动态路由协议的基础,只有完全理解了静态路由的工作原理,并掌握了其配置方法才能更好的学习后面的各种动态路由协议。 |


(2台路由与3台路由环境)
564554243
博客统计信息
热门文章
最新评论
友情链接