配置直连路由&静态路由

目录

配置直连路由&静态路由(默认路由)

配置接口IP

多种情况下配置接口IP

查看个接口信息

查看接口状态为什么有2个up

工业互联网静态路由实验1_路由器通过GigabitEthernet

工业互联网静态路由实验2_通过Serial Port互联


配置接口IP

多种情况下配置接口IP

1. 拓扑图

isco packet tracer 6.2不允许路由器通过直通线直接接PC(路由器要么通过交叉线连PC,要么通过交换机连PC),cisco packet tracer 8.2.1允许路由器和PC通过直通线直接互联。这体现了时代的变迁和技术的发展。

R1的Gi0/1口(三层口)接SW1,再由SW1接PC1,实际是Gi0/1直接接PC1。

R1的Gi0/2口(层口)接SW2,再由SW2接PC2,实际是Gi0/2直接接PC2。

上图中R1由三个直连路由,具体配置如下:

2. 接口(直连路由)配置脚本

思科2911路由器三层口默认情况下都是shutdown,要开启,就需要输入命令(no shutdown)

思科3560交换机 gigabitethernet默认情况下是二层口(switchport),要使用三层功能,要先进入该端口,然后输入命令no switchport。

配置脚本如下:

R1

enable

configure terminal

no ip domain-lookup

hostname R1

interface gigabitethernet 0/0

no shutdown

ip address 10.10.0.1 255.255.255.252

interface gigabitethernet 0/1

no shutdown

ip address 10.10.10.1 255.255.255.252

interface gigabitethernet 0/2

no shutdown

ip address 10.10.20.1 255.255.255.252

end

write

copy running-config startup-config

R2

enable

configure terminal

no ip domain-lookup

hostname R2

interface gigabitethernet 0/0

no shutdown

ip address 10.10.0.2 255.255.255.252

end

write

copy running-config startup-config

配置中不包含静态路由或动态路由配置,因此PC无法ping通,静态路由实验在后面。

查看个接口信息

R1#show ip interface brief

查看接口状态为什么有2up

路由器和光纤收发器是互联的,此时两端的接口都是up的,光纤收发器之间通过光纤互联,当光纤收发器间的光纤中断,路由器到光纤收发器的口依然up,,但此时,再看路由器的口,会发现line protocol is down,这就是为什么有两个up的原因。

工业互联网静态路由实验1_路由器通过GigabitEthernet

1. 拓扑图

https://mooc1.chaoxing.com/ananas/ueditor/themes/default/images/spacer.gif

1_路由器间通过GigabitEthernet Port互联,PC直连到路由器的GigabitEthernet Port。

实际工作中这样的拓扑结构和静态路由配置不合理,一般都采用动态路由协议(如OSPF或BGP),这个拓扑只是为了更好的帮助理解静态路由、直连路由、默认路由。

2. 配置命令

A厂区cisco 2911配置

enable

configure terminal

no logging on

interface gigabitEthernet 0/1

ip address 128.10.10.1 255.255.255.0

no shutdown

interface gigabitEthernet 0/0

ip address 10.10.10.1 255.255.255.252

no shutdown

B厂区cisco 2911配置

enable

configure terminal

no logging on

 

interface gigabitEthernet 0/0

ip address 10.10.10.2 255.255.255.252

no shutdown

 

interface gigabitEthernet 0/1

ip address 10.10.20.1 255.255.255.252

no shutdown

3、配置完毕后发现端口依然是down

失败原因:早期设备连接的网线分为直通线和交叉线,路由器接PC只能通过交叉线,如果使用直通线端口不会up。同理路由器之间互联也只能通过交叉线。直通线和交叉线的区别就是RJ45的中的线的顺序不一致。现在早已经不分了。

cisco packet tracer6.2中区分直通线和交叉线,而cisco packet tracer 8.2.1中已经不区分直通线和交叉线。

在cisco packet tracer模拟器中路由器间互联只能通过serial口(实际工作中,由于带宽限制,这种口早已被淘汰)。

工业互联网静态路由实验2_通过Serial Port互联

1. 拓扑图2.0 

本拓扑特点:路由器通过Serial Port互联,PC使用直通线通过交换机连接到Cisco 2911路由器。

2. 四台路由器配置脚本-(初始配置+接口配置+保存)

1)柳南厂区路由器

enable

configure terminal

no ip domain-lookup

hostname LiuNan

interface GigabitEthernet0/0

ip address 128.10.10.1 255.255.255.0

no shutdown

interface Serial0/0/0

ip address 10.10.10.1 255.255.255.252

no shutdown

end

write

copy running-config startup-config

2)沙塘厂区路由器

enable

configure terminal

no ip domain-lookup

hostname ShaTang

interface Serial 0/0/0

ip address 10.10.10.2 255.255.255.252

no shutdown

interface Serial 0/0/1

ip address 10.10.20.1 255.255.255.252

no shutdown

end

write

copy running-config startup-config

3)河西工业园厂区路由器

enable

configure terminal

no ip domain-lookup

hostname HeXi

interface Serial 0/0/1

ip address 10.10.20.2 255.255.255.252

no shutdown

interface Serial 0/0/0

ip address 10.10.30.1 255.255.255.252

no shutdown

end

write

copy running-config startup-config

4)柳东厂区路由器

enable

configure terminal

no ip domain-lookup

hostname LiuDong

interface Serial 0/0/0

ip address 10.10.30.2 255.255.255.252

no shutdown

interface GigabitEthernet0/0

ip address 128.10.20.1 255.255.255.0

no shutdown

end

write

copy running-config startup-config

3 查看柳南厂区路由器上的路由

  • 31
    点赞
  • 37
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

计网1班-廖晶莹

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值