路由器IP的配置方式?
路由器IP的配置方式?
- 案例1:配置静态路由
- 案例2:配置浮动路由
- 案例3:配置多路由的静态路由
- 案例4:配置默认路由
1 案例1:配置静态路由
1.1 问题
配置路由接口IP地址并通过静态路由的配置实现全网的互通。
1.2 方案
按如下网络拓扑配置接口IP地址并通过静态路由的配置实现全网的互通如图-1所示:
图-1
1.3 步骤
实现此案例需要按照如下步骤进行。
步骤一:配置静态路由
1)R1上配置接口IP
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown
2)R2上配置接口IP
R2(config)#interface fastEthernet 0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2config-if)#exit
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.4.254 255.255.255.0
R2(config-if)#no shutdown
3)R1上添加静态路由
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2
4)R1上查看路由表
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
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S 192.168.4.0/24 [1/0] via 192.168.2.2 //S表示静态路由
5)R2上添加静态路由
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
6)R2上查看路由条目
R2#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
S 192.168.1.0/24 [1/0] via 192.168.2.1 //S表示静态路由
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
7)配置PC1的IP地址为192.168.1.1,网关为192.168.1.254
8)配置PC2的IP地址为192.168.4.1,网关为192.168.4.254
9)测试网络连通性,PC1 ping 192.168.4.1
PC>ping 192.168.4.1
Pinging 192.168.4.1 with 32 bytes of data:
Reply from 192.168.4.1: bytes=32 time=1ms TTL=126
Reply from 192.168.4.1: bytes=32 time=11ms TTL=126
Reply from 192.168.4.1: bytes=32 time=10ms TTL=126
Reply from 192.168.4.1: bytes=32 time=11ms TTL=126
Ping statistics for 192.168.4.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 1ms, Maximum = 11ms, Average = 8ms
2 案例2:配置浮动路由
2.1 问题
配置浮动静态路由
2.2 方案
按如下网络拓扑配置接口IP地址配置浮动路由实现链路的冗余,如图-2所示
图-2
2.3 步骤
实现此案例需要按照如下步骤进行。
步骤一:配置静态路由并添加模块
1)R1上配置接口IP
在以上静态路由实验的基础上,先分别进入R1与R2的特权模式输入write命令保存配置信息,然后分别进入R1与R2的物理配置界面,点击开关按钮关闭路由器,添加NM-1FE-TX模块并再次点击开关按钮,如下图-3所示。
图-3
2)添加模块后将R1的F1/0接口连接到R2的F1/0接口修改拓扑如下图-4所示:
图-4
3)配置R1的F1/0接口IP
R1(config)#interface fastEthernet 1/0
R1(config-if)#ip address 192.168.3.1 255.255.255.0
R1(config-if)#no shutdown
4)配置R2的F1/0接口IP
R2(config)#interface fastEthernet 1/0
R2(config-if)#ip address 192.168.3.2 255.255.255.0
R2(config-if)#no shutdown
5)R1上添加静态浮动路由
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2 50 //管理距离50
6)R2上添加静态浮动路由
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1 50 //管理距离50
7)R1上查看路由表
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
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet1/0
S 192.168.4.0/24 [1/0] via 192.168.2.2 //只有下一跳为192.168.2.2的静态路由
8)禁用F/01接口
R1(config)#interface fastEthernet 0/1
R1(config-if)#shutdown
9)R1上查看路由表
C 192.168.1.0/24 is directly connected, FastEthernet0/0
S 192.168.4.0/24 [50/0] via 192.168.3.2//下一跳接口为192.168.4.2的路由生效
C 192.168.4.0/24 is directly connected, FastEthernet1/0
10)测试网络连通性,PC1 ping 192.168.4.1
PC>ping 192.168.4.1
Pinging 192.168.4.1 with 32 bytes of data:
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=10ms TTL=126
Reply from 192.168.4.1: bytes=32 time=11ms TTL=126
Reply from 192.168.4.1: bytes=32 time=1ms TTL=126
Ping statistics for 192.168.4.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 11ms, Average = 5ms
3 案例3:配置多路由的静态路由
3.1 问题
配置多路由的静态路由
3.2 方案
网络环境及IP地址规划,如图-5所示
图-5
3.3 步骤
实现此案例需要按照如下步骤进行。
步骤一:配置路由IP和静态路由
1) R1上配置接口IP
Router(config)#interface fastEthernet 0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface fastEthernet 0/1
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown
2)R2上配置接口IP
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.2.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface fastEthernet 0/0
R2(config-if)#ip address 192.168.3.1 255.255.255.0
R2(config-if)#no shutdown
3)R3上配置接口IP
R3(config)#interface fastEthernet 0/1
R3(config-if)#ip address 192.168.3.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
R3(config)#interface fastEthernet 0/0
R3(config-if)#ip address 192.168.4.254 255.255.255.0
R3(config-if)#no shutdown
4)R1、R2、R3上分别添加静态路由
R1(config)#ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#ip route 192.168.4.0 255.255.255.0 192.168.2.2
R2(config)#ip route 192.168.1.0 255.255.255.0 192.168.2.1
R2(config)#ip route 192.168.4.0 255.255.255.0 192.168.3.2
R3(config)#ip route 192.168.1.0 255.255.255.0 192.168.3.1
R3(config)#ip route 192.168.2.0 255.255.255.0 192.168.3.1
5)R1上查看路由表
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
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S 192.168.3.0/24 [1/0] via 192.168.2.2 //静态路由
S 192.168.4.0/24 [1/0] via 192.168.2.2 //静态路由
6)R2上查看路由表
R2#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
S 192.168.1.0/24 [1/0] via 192.168.2.1 //静态路由
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
S 192.168.4.0/24 [1/0] via 192.168.3.2 //静态路由
7)R3上查看路由表
R3#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
S 192.168.1.0/24 [1/0] via 192.168.3.1 //静态路由
S 192.168.2.0/24 [1/0] via 192.168.3.1 //静态路由
C 192.168.3.0/24 is directly connected, FastEthernet0/1
C 192.168.4.0/24 is directly connected, FastEthernet0/0
8)按图-4配置PC的IP地址
9)测试网络连通性,PC1 ping 192.168.2.2、192.168.3.1、192.168.3.2、192.168.4.1
PC>ping 192.168.2.2 //ping 192.168.2.2
Pinging 192.168.2.2 with 32 bytes of data:
Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
Reply from 192.168.2.2: bytes=32 time=0ms TTL=254
Ping statistics for 192.168.2.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping 192.168.3.1 //ping 192.168.3.1
Pinging 192.168.3.1 with 32 bytes of data:
Reply from 192.168.3.1: bytes=32 time=0ms TTL=254
Reply from 192.168.3.1: bytes=32 time=3ms TTL=254
Reply from 192.168.3.1: bytes=32 time=0ms TTL=254
Reply from 192.168.3.1: bytes=32 time=0ms TTL=254
Ping statistics for 192.168.3.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 3ms, Average = 0ms
PC>ping 192.168.3.2 //ping 192.168.3.2
Pinging 192.168.3.2 with 32 bytes of data:
Reply from 192.168.3.2: bytes=32 time=0ms TTL=253
Reply from 192.168.3.2: bytes=32 time=12ms TTL=253
Reply from 192.168.3.2: bytes=32 time=0ms TTL=253
Reply from 192.168.3.2: bytes=32 time=12ms TTL=253
Ping statistics for 192.168.3.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 12ms, Average = 6ms
PC>ping 192.168.4.1 //ping 192.168.4.1
Pinging 192.168.4.1 with 32 bytes of data:
Reply from 192.168.4.1: bytes=32 time=0ms TTL=125
Reply from 192.168.4.1: bytes=32 time=10ms TTL=125
Reply from 192.168.4.1: bytes=32 time=0ms TTL=125
Reply from 192.168.4.1: bytes=32 time=22ms TTL=125
Ping statistics for 192.168.4.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 22ms, Average = 8ms
4 案例4:配置默认路由
4.1 问题
配置默认路由
4.2 方案
网络环境及IP地址规划,如图-6所示
图-6
4.3 步骤
1)在案例3基础上删除R1与R3的静态路由
R1(config)#no ip route 192.168.3.0 255.255.255.0 192.168.2.2
R1(config)#no ip route 192.168.4.0 255.255.255.0 192.168.2.2
R3(config)#no ip route 192.168.1.0 255.255.255.0 192.168.3.1
R3(config)#no ip route 192.168.2.0 255.255.255.0 192.168.3.1
2)R1、R3添加默认路由
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.3.1
12)R1上查看路由表
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 192.168.2.2 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 [1/0] via 192.168.2.2 //默认路由
3)R1、R3上查看路由表
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 192.168.3.1 to network 0.0.0.0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, FastEthernet0/1
S* 0.0.0.0/0 [1/0] via 192.168.2.2 //默认路由
R3#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 192.168.3.1 to network 0.0.0.0
C 192.168.3.0/24 is directly connected, FastEthernet0/1
C 192.168.4.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 [1/0] via 192.168.3.1 //默认路由
4)测试网络连通性,PC1 ping 192.168.4.1
- PC>ping 192.168.4.1
- Pinging 192.168.4.1 with 32 bytes of data:
- Reply from 192.168.4.1: bytes=32 time=1ms TTL=125
- Reply from 192.168.4.1: bytes=32 time=0ms TTL=125
- Reply from 192.168.4.1: bytes=32 time=14ms TTL=125
- Reply from 192.168.4.1: bytes=32 time=14ms TTL=125
- Ping statistics for 192.168.4.1:
- Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
- Approximate round trip times in milli-seconds:
- Minimum = 0ms, Maximum = 14ms, Average = 7ms = 0ms,平均 = 0ms
路由器IP的配置方式?相关推荐
- Cisco 2651路由器IP电话配置
Cisco 2651中IP Phone配置与修改 一.使用Cisco 2651路由器IP电话配置向导进行配置 router# conf t router# int f0/0 router()#ip a ...
- 实验3 路由器的基本配置和远程登录
[实验目的和要求] (1)掌握路由器常用的配置方式和基本配置命令: (2)正确配置telnet远程登录到路由器. [实验内容] 通过Console接口对路由器进行名字.特权密码.管理IP.远程登录密码 ...
- GX Work2 三菱 FX-Q系列IP地址配置
功能概述 Q系列IP地址配置分为两种情况,一:是CPU自带网口的配置,二:是网络模块的配置. 一.自带网口配置 1. 通过GX Work2软件下载PLC程序. 2. 在工程栏中双击打开参数 ...
- 办公室局域网主机为静态ip时配置路由器由器的方案
办公室本机静态ip时配置路由器 前情提要 方案1:配置路由器静态ip (不推荐) 方案2:使用网络共享分配给路由器 (我使用的方案) 工具 连接方式 网络共享配置 前情提要 公司使用的是交换机接入到工 ...
- 实验二 路由器配置方式及基本操作
[实验目的] 通过对路由器设备的几种配置手段.配置模式和基本配置命令的认识,获得路由器的基本使用能力. [实验任务] 1.认识路由器的配置方式. 2.按照给出的参考拓扑图构建逻辑拓扑图. 3.按照给出 ...
- 配置路由器IP及测试连通性
实验步骤: 1.连接两台路由器,路由器开机 2.进入路由器后台,配置路由器IP地址 3.两台路由器都配置好后,ping测试链路是否正常通信
- 华为交换机不同vlan通过DHCP中继方式获取IP的配置方法
不同vlan通过DHCP中继方式获取IP的配置方法 1. 规划拓扑及VLAN,IP 2. Windows server 2016 DHCP服务器配链接描述 https://blog.51cto.com ...
- 【渗透测试】Lin.Security靶机渗透练习_虚拟机无法获取ip的配置方法+靶机多种提权方式练习
靶机描述:在in.security,我们希望开发一个Linux虚拟机,该虚拟机在编写本文时基于最新的Ubuntu发行版(18.04 LTS),但存在许多漏洞,这些漏洞使用户无法升级扎根在盒子上.旨在帮 ...
- LInux初学者 必学 三种配置网卡IP地址的方式(非常详细)
弱智选择安逸,强者选择永往向前.本文讲解Linux图形化.shell.命令三种方式配置IP地址静态网卡信息 基础 文章目录 目录 一.IP基础 二.三种网卡配置方式 1.图形化界面 2.nmtui:在 ...
最新文章
- typeof操作符的返回值
- Jquery 常用方法经典总结
- 从IT转行做网店奋斗历程
- 初识设计模式、软件设计的六大原则
- JQuery果然是神器,这里顺便测试一下我发现的那个漏洞!
- 设计模式--装饰模式
- 重新学.Net[一]——.Net的组成
- leetcode551. 学生出勤记录 I
- [机器学习-坑] error: Microsoft Visual C++ 14.0 is required
- 关系运算符 与 逻辑运算符
- CentOS7 下安装telnet服务
- 常见的INI(PHP)配置
- 关于绑定事件的一个疑惑
- 一个Keil工程包含的内容
- Xpose实例分析-变色龙
- 深度学习常用显卡比较
- 家庭局域网的组建(2台或2台以上)
- Underexposed Photo Enhancement using Deep Illumination Estimation阅读札记
- 笔记_KMeans聚类
- <<算法很美>>——(七)——DFS典题(一):水洼数目