Router Configuration5
静态路由配置
Target:
理解静态路由的工作原理,掌握如何配置静态路由。
实验原理:
路由器属于网络层设备,能够根据IP包头的信息,选择一条最佳路径,将数据包转发出去。实现不同网段的主机之间的互相访问。
路由器是根据路由表进行选路和转发的。而路由表里就是由一条条的路由信息组成。路由表的产生方式一般有3种:
1 直连路由 给路由器接口配置一个IP地址,路由器自动产生本接口IP所在网段的路由信息。
2 静态路由在拓扑结构简单的网络中,网管员通过手工的方式配置本路由器未知
网段的路由信息,从而实现不同网段之间的连接。
3 动态路由协议学习产生的路由在大规模的网络中,或网络拓扑相对复杂的情况下,通过在路由器上运行动态路由协议,路由器之间互相自动学习产生路由信息。
实验拓扑图:
实验设备:
路由器(带串口) 2台
V.35 DCE/DTE电缆 1对
Step:
第一步:配置路由器的名称、接口IP地址和时钟
R3740#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3740(config)#hostname RouterA
!配置路由器的名称
RouterA(config)#
RouterA(config)#interface serial 4/0
!进入端口S4/0的接口配置模式
RouterA(config-if)#clock rate 512000
!设置串口的时钟
RouterA(config-if)#ip address 192.168.1.1 255.255.255.0
!设置端口的IP地址
RouterA(config-if)#no shutdown
!开启端口
RouterA(config-if)#exit
RouterA(config)#
RouterA(config)#interface loopback 0
!设置Loopback端口用于测试
RouterA(config-if)#Sep 15 01:05:02 RouterA %7:%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP
RouterA(config-if)#ip address 172.16.1.1 255.255.255.0
RouterA(config-if)#exit
RouterA(config)#
RouterA(config)#interface loopback 1
RouterA(config-if)#Sep 15 01:05:31 RouterA %7:%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP
RouterA(config-if)#ip address 172.16.2.1 255.255.255.0
RouterA(config-if)#exit
R3740#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R3740 (config)#hostname RouterB
RouterB(config)#
RouterB(config)#interface serial 4/0
RouterB(config-if)#ip address 192.168.1.2 255.255.255.0
RouterB(config-if)#no shutdown
RouterB(config-if)#exit
RouterB(config)#
RouterB(config)#interface loopback 0
RouterB(config-if)#Aug 22 03:03:36 RouterB %7:%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP
RouterB(config-if)#ip address 10.1.1.1 255.255.255.0
RouterB(config-if)#exit
RouterB(config)#
RouterB(config)#interface loopback 1
RouterB(config-if)#Aug 22 03:04:03 RouterB %7:%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP
RouterB(config-if)#ip address 10.2.2.1 255.255.255.0
RouterB(config-if)#exit
第二步:配置静态路由
RouterA(config)#ip route 10.1.1.0 255.255.255.0 192.168.1.2
!设置到子网10.1.1.0的静态路由,采用下一跳的方式
RouterA(config)#ip route 10.2.2.0 255.255.255.0 s4/0
!设置到子网10.2.2.0的静态路由,采用出站端口的方式
RouterB(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.1
RouterB(config)#ip route 172.16.2.0 255.255.255.0 s4/0
第三步:查看路由表和接口配置
RouterA#show ip route
Codes: C - connected, S - static, R - RIP B - BGP
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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is no set
S 10.1.1.0/24 [1/0] via 192.168.1.2
S 10.2.2.0/24 is directly connected, serial 4/0
C 172.16.1.0/24 is directly connected, Loopback 0
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, Loopback 1
C 172.16.2.1/32 is local host.
C 192.168.1.0/24 is directly connected, serial 4/0
C 192.168.1.1/32 is local host.
!可以看到以下一跳方式配置的静态路由和以出站端口方式配置的静态路由,在路由表中的显示方式是不一样的
RouterA#show interfaces serial 4/0
Index(dec):1 (hex):1
serial 4/0 is UP , line protocol is UP
Hardware is Infineon DSCC4 PEB20534 H-10 serial
Interface address is: 192.168.1.1/24
MTU 1500 bytes, BW 2000 Kbit
Encapsulation protocol is HDLC, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: WFQ
11421118 carrier transitions
V35 DCE cable
DCD=up DSR=up DTR=up RTS=up CTS=up
5 minutes input rate 19 bits/sec, 0 packets/sec
5 minutes output rate 19 bits/sec, 0 packets/sec
95 packets input, 4134 bytes, 0 no buffer, 1 dropped
Received 69 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort
94 packets output, 4118 bytes, 0 underruns , 0 dropped
0 output errors, 0 collisions, 0 interface resets
RouterB#show ip route
Codes: C - connected, S - static, R - RIP B - BGP
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, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default
Gateway of last resort is no set
C 10.1.1.0/24 is directly connected, Loopback 0
C 10.1.1.1/32 is local host.
C 10.2.2.0/24 is directly connected, Loopback 1
C 10.2.2.1/32 is local host.
S 172.16.1.0/24 [1/0] via 192.168.1.1
S 172.16.2.0/24 is directly connected, serial 4/0
C 192.168.1.0/24 is directly connected, serial 4/0
C 192.168.1.2/32 is local host.
RouterB#show interfaces serial 4/0
Index(dec):1 (hex):1
serial 4/0 is UP , line protocol is UP
Hardware is Infineon DSCC4 PEB20534 H-10 serial
Interface address is: 192.168.1.2/24
MTU 1500 bytes, BW 2000 Kbit
Encapsulation protocol is HDLC, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: WFQ
11421118 carrier transitions
V35 DTE cable
DCD=up DSR=up DTR=up RTS=up CTS=up
5 minutes input rate 74 bits/sec, 0 packets/sec
5 minutes output rate 74 bits/sec, 0 packets/sec
86 packets input, 3942 bytes, 0 no buffer, 0 dropped
Received 61 broadcasts, 0 runts, 0 giants
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 abort
87 packets output, 3964 bytes, 0 underruns , 0 dropped
0 output errors, 0 collisions, 1 interface resets
第四步:测试网络连通性
RouterA#ping 10.1.1.1
Sending 5, 100-byte ICMP Echoes to 10.1.1.1, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms
RouterA#ping 10.2.2.1
Sending 5, 100-byte ICMP Echoes to 10.2.2.1, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms
RouterB#ping 172.16.1.1
Sending 5, 100-byte ICMP Echoes to 172.16.1.1, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms
RouterB#ping 172.16.2.1
Sending 5, 100-byte ICMP Echoes to 172.16.2.1, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/10 ms
【注意事项】
1、如果两台路由器通过串口直接互连,则必须在其中一端设置时钟频率(DCE)。
2、静态路由必须双向都配置才能互通,配置时注意回程路由。
【参考配置】
RouterA#show running-config
Building configuration...
Current configuration : 745 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)
hostname RouterA
!
!
interface serial 4/0
ip address 192.168.1.1 255.255.255.0
clock rate 512000
!
interface serial 4/1
clock rate 64000
!
interface GigabitEthernet 0/0
duplex auto
speed auto
!
interface GigabitEthernet 0/1
duplex auto
speed auto
!
interface Loopback 0
ip address 172.16.1.1 255.255.255.0
!
interface Loopback 1
ip address 172.16.2.1 255.255.255.0
!
ip route 10.1.1.0 255.255.255.0 192.168.1.2
ip route 10.2.2.0 255.255.255.0 serial 4/0
!
line con 0
line aux 0
line vty 0 4
login
!
end
RouterB#show running-config
Building configuration...
Current configuration : 725 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 21:16:17 CST 2007 -ubu1server)
hostname RouterB
!
!
interface serial 4/0
ip address 192.168.1.2 255.255.255.0
!
interface serial 4/1
clock rate 64000
!
interface GigabitEthernet 0/0
duplex auto
speed auto
!
interface GigabitEthernet 0/1
duplex auto
speed auto
!
interface Loopback 0
ip address 10.1.1.1 255.255.255.0
!
interface Loopback 1
ip address 10.2.2.1 255.255.255.0
!
ip route 172.16.1.0 255.255.255.0 192.168.1.1
ip route 172.16.2.0 255.255.255.0 serial 4/0
!
line con 0
line aux 0
line vty 0 4
login
!
end
转载于:https://blog.51cto.com/yxh51netsec/1286617
Router Configuration5相关推荐
- React router 的 Route 中 component 和 render 属性理解
React router 的 Route 中 component 和 render 属性理解 Route 标签的三个互斥属性 render.component.children Route 就是用来匹 ...
- 几个经常用到的angular路由Router、ActivatedRoute 知识点:嵌套路由、路由跳转、路由传参、路由参数获取
深度玩家可移步Angular - 常见路由任务 1.嵌套路由 const routes: Routes = [{path: 'first',component: FirstComponent,//同步 ...
- this.$router.push、replace、go的区别
1.this.$router.push() 描述:跳转到不同的url,但这个方法会向history栈添加一个记录,点击后退会返回到上一个页面. 用法: 2.this.$router.replace() ...
- router路由react_使用React Router在React中受保护的路由
router路由react In this video, you will see how to create a protected route using React Router. This r ...
- hitchhiker部署_Hitchhiker的React Router v4指南:无限远的递归路径!
hitchhiker部署 Welcome to the third part of the Hitchhiker's Guide to React Router v4. In this article ...
- vue router 入门笔记
vue router 入门笔记 tips: components优先级大于component,即当一个route对象里同时配置了component和components时component视为无效 即 ...
- 四 Vue学习 router学习
index.js: 按需加载组件: const login = r => require.ensure([], () => r(require('@/page/login')), 'log ...
- Express4.x API (四):Router (译)
Express4.x API 译文 系列文章 Express4.x API (一):application (译) -- 完成 Express4.x API (二):request (译) -- 完成 ...
- [React Router v4] Intercept Route Changes
If a user has entered some input, or the current Route is in a "dirty" state and we want t ...
最新文章
- 【脚下生根】之深度探索安卓OpenGL投影矩阵
- 视图加载时自动执行铵钮事件
- 摇滚java游戏_java 集合类
- 空值用前值填充_Excel数据填充,原来这么简单
- 5G 即将带来冲击!| 畅言
- 人脸识别撞脸名画_范冰冰深夜晒自拍撞脸荷兰名画,三万元名牌包抢镜,两套餐具亮了...
- java.lang.Class解析
- [转载] python字符串表示方法_python字符串使用方法归纳
- 学生成绩分析之成绩的预处理 python3 pandas 学生成绩汇总到一张表
- 0-50A集成式霍尔电流传感器应用案例分享
- EasyUI(DataGrid修改删除)
- 盘点B站up主常用的免费录屏软件,自用工具分享
- C++图像处理 -- 图像翻转(镜像)
- executeUpdate()和execute()的区别
- 异常检测——5月(task1)
- 社区运营秘笈:病毒式营销!
- 移动安全框架(MobSF)
- 如果要求在使用计算机编辑文档,计算机应用基础专作业2-文档编辑.doc
- C#获取感JY901M_485姿态传器的X Y Z角度
- 【Codeforces 652 C Foe Pairs 】
热门文章
- TLStorm:APC UPS 存在零点击0day,可远程烧毁设备、切断电源
- AMD CPU驱动被曝漏洞,可使 KASLR崩溃、密码泄露
- 数据保护法规可被滥用于人肉 GitLab 用户和接管账户
- PHP使用CodeIgniter笔记
- [转] C++中 const, volatile, mutable用法
- 多控制器之UIWindow
- Ant构建与部署Java项目---入门
- CMSIS-SVD Schema File Ver. 1.0
- eclipse建java项目不见_秒建一个后台管理系统?用这5个开源免费的Java项目就够了...
- 【note】编程范式(编程范型)的含义和种类,多范式编程语言