静态路由时管理员手动配置并维护的路由。静态路由配置简单,被广泛应用于网络中。静态路由还可以实现负载均衡和路由备份。学习掌握好静态路由的配置是很重要的。

如下图,

首先进入路由器的命令视图,(sys)

配置各个接口的ip地址

[Huawei]interface LoopBack 0
[Huawei-LoopBack0]ip address 10.0.2.2 24
[Huawei-LoopBack0]q
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 10.0.12.2 24
Oct 10 2019 21:55:49-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 10.0.23.2 24

配置静态路由,指向S3与S2配置格式为:ip route-static 路由器地址  掩码  接口地址

[Huawei]ip route-static 10.0.3.3 24 10.0.23.3
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.3.0/24 was generated.
[Huawei]ip route-static 10.0.1.1 24 10.0.12.1
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.1.0/24 was generated.

与上步格式相同,改变参数即可,此段代码配置的为S3的端口ip与静态路由

[Huawei-LoopBack0]ip address 10.0.3.3 24
[Huawei-LoopBack0]q
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip a
[Huawei-GigabitEthernet0/0/0]ip accounting
[Huawei-GigabitEthernet0/0/0]ip address 10.0.23.3 24
Oct 10 2019 22:13:37-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip a
[Huawei-GigabitEthernet0/0/1]ip accounting
[Huawei-GigabitEthernet0/0/1]ip address 10.0.13.3 24
Oct 10 2019 22:14:26-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ip route
[Huawei]ip route
[Huawei]ip route-static 10.0.2.2 24 10.0.23.2
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.2.0/24 was generated.
[Huawei]ip route
[Huawei]ip route
[Huawei]ip route-static 10.0.1.1 24 10.0.13.1
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.1.0/24 was generated.

与上步格式相同,改变参数即可,此段代码配置的为S2的端口ip与静态路由

<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]interface loop
[Huawei]interface LoopBack 0
[Huawei-LoopBack0]ip a
[Huawei-LoopBack0]ip address 10.0.1.1 24
[Huawei-LoopBack0]q
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]ip a
[Huawei-GigabitEthernet0/0/0]ip accounting
[Huawei-GigabitEthernet0/0/0]ip address 10.0.12.1 24
Oct 10 2019 22:18:41-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[0]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the UP state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/1
[Huawei-GigabitEthernet0/0/1]ip a
[Huawei-GigabitEthernet0/0/1]ip accounting
[Huawei-GigabitEthernet0/0/1]ip address 10.0.13.1 24
Oct 10 2019 22:19:32-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/1 has entered the UP state.
[Huawei-GigabitEthernet0/0/1]q
[Huawei]ip route
[Huawei]ip route
[Huawei]ip route-static 10.0.2.2 24 10.0.12.2
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.2.0/24 was generated.
[Huawei]ip route
[Huawei]ip route
[Huawei]ip route-static 10.0.3.3 24 10.0.13.3
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.3.0/24 was generated.

测试是否ping通,经过测试发现都能实现互通,静态路由配置完毕

[Huawei]ping 10.0.1.1
PING 10.0.1.1: 56 data bytes, press CTRL_C to break
Reply from 10.0.1.1: bytes=56 Sequence=1 ttl=255 time=20 ms
Reply from 10.0.1.1: bytes=56 Sequence=2 ttl=255 time=30 ms
Reply from 10.0.1.1: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 10.0.1.1: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.0.1.1: bytes=56 Sequence=5 ttl=255 time=30 ms

--- 10.0.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms

[Huawei]ping 10.0.3.3
PING 10.0.3.3: 56 data bytes, press CTRL_C to break
Reply from 10.0.3.3: bytes=56 Sequence=1 ttl=255 time=30 ms
Reply from 10.0.3.3: bytes=56 Sequence=2 ttl=255 time=20 ms
Reply from 10.0.3.3: bytes=56 Sequence=3 ttl=255 time=20 ms
Reply from 10.0.3.3: bytes=56 Sequence=4 ttl=255 time=30 ms
Reply from 10.0.3.3: bytes=56 Sequence=5 ttl=255 time=30 ms

--- 10.0.3.3 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/26/30 ms

模拟网络发生故障,关闭S3的GE0/0/0端口并配置备份静态路由

S3指向S1的备份静态路由

[Huawei]interface g
[Huawei]interface GigabitEthernet 0/0/0
[Huawei-GigabitEthernet0/0/0]shutdown   ####关闭0/0/0端口
Oct 10 2019 22:30:26-08:00 Huawei %%01IFPDT/4/IF_STATE(l)[0]:Interface GigabitEt
hernet0/0/0 has turned into DOWN state.
[Huawei-GigabitEthernet0/0/0]
[Huawei-GigabitEthernet0/0/0]
Oct 10 2019 22:30:26-08:00 Huawei %%01IFNET/4/LINK_STATE(l)[1]:The line protocol
IP on the interface GigabitEthernet0/0/0 has entered the DOWN state.
[Huawei-GigabitEthernet0/0/0]q
[Huawei]ip rou
[Huawei]ip route
[Huawei]ip route-static 10.0.2.2 24 10.0.13.1
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.2.0/24 was generated.
[Huawei]ip rou
[Huawei]ip route
[Huawei]ip route-static 10.0.12.2 24 10.0.13.1
Info: The destination address and mask of the configured static route mismatched
, and the static route 10.0.12.0/24 was generated.

实现互通,ping命令测试

[Huawei]ping 10.0.2.2
PING 10.0.2.2: 56 data bytes, press CTRL_C to break
Reply from 10.0.2.2: bytes=56 Sequence=1 ttl=254 time=30 ms
Reply from 10.0.2.2: bytes=56 Sequence=2 ttl=254 time=30 ms
Reply from 10.0.2.2: bytes=56 Sequence=3 ttl=254 time=20 ms
Reply from 10.0.2.2: bytes=56 Sequence=4 ttl=254 time=30 ms
Reply from 10.0.2.2: bytes=56 Sequence=5 ttl=254 time=30 ms

--- 10.0.2.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 20/28/30 ms

缺省路由配置,ip route-static  0.0.0.0 0 nextHop

[Huawei]ip route-static 0.0.0.0 0 10.0.13.1

路由器静态IP的配置及其备份静态路由缺省路由的更多相关文章

  1. VirtualBox 下 CentOS7 静态 IP 的配置 → 多次踩坑总结,蚌埠住了!

    开心一刻 一个消化不良的病人向医生抱怨:我近来很不正常,吃什么拉什么,吃黄瓜拉黄瓜,吃西瓜拉西瓜,怎样才能恢复正常呢? 医生沉默片刻:那你只能吃屎了 环境准备 VirtualBox 6.1 网络连接方 ...

  2. Ubuntu Server 12.04 静态IP简洁配置

    PS:很长时间没使用Ubuntu了,刚才安装个Ubuntu Server 12.04做测试.Ubuntu的网络设置跟Redhat系是不一样的,配置IP时发现跟以前的Ubuntu桌面版本也有所不同,记录 ...

  3. ubuntn 虚拟机NAT 静态IP 网络配置

    在虚拟机安装ubuntu12.04自动获取IP 一切都没有问题 ssh连接也正常.关机重启后郁闷的发现网络已经不通了,于是开始了以下的摸索. 1.配置静态IP 网关: ip段: 命令: Vim /et ...

  4. 【转】Ubuntu Server 12.04 静态IP简洁配置

    原文网址:http://blog.csdn.net/njchenyi/article/details/8715417 1.配置静态IP地址: # vim /etc/network/interfaces ...

  5. Ubuntu Server 12.04(14.04) 静态IP简洁配置

    1.配置静态IP地址: # vim /etc/network/interfaces 原内容有如下4行:auto loiface lo inet loopback auto eth0iface eth0 ...

  6. 虚拟机设置静态IP与配置网络

    不废话,直接上图 一:先配置虚拟机的网络 二:配置win10-VM8网络 三:查看以太网的ip信息,直接在管理员命令中输入 ipconfig /all可以到连接信息 四:如果在上面找不到VM8的网络信 ...

  7. centos7 安装后静态ip的配置

    centos7 想到于centos6.5来说界面上看起来更加炫一点,但是在配置静态ip上来说是差不多的 首先看一下centos7的安装界面,相对来说简洁好看一些 先打开终端 可以看到centos7默认 ...

  8. VMWare虚拟机NAT模式静态IP联网配置

    1.网络连接    vmnet8右键属性ipv4,设置ip为192.168.10.100.如下图: 2.设置虚拟机的网络适配器采用NAT模式 3.vmware工具栏的编辑->虚拟网络编辑器   ...

  9. Hyper-V 下linux虚拟机静态IP上网配置的两种方式(2)

    工作需要,搭建linux环境,网上搜了两种Hyper-V配置linux静态IP及上网的方式,记录一下,方便查阅,如下设置网络共享方式: win10下使用hyper-v在本机安装linux虚拟机后,网络 ...

随机推荐

  1. mysql解压版服务启动方式

    使用mysql解压版,在不安装为windows服务时,使用下面的方式启动. 1.打开命令行,首先进入mysql解压目录的bin目录下 d:\mysql\bin 2.输入mysqld --console ...

  2. Python—字符串和常用数据结构

    目录 1. 字符串 2. 列表 2.1 列表的增删改查 2.2 列表的切片和排序 2.3 生成式语法 3. 元组 4.集合 5. 字典 5.1 字典的增删改查 5.2 字典的常见操作 序言:这一章我们 ...

  3. MySQL设计表规范

    规范总结 所有数据库对象名称必须使用小写字母并用下划线分割 所有数据库对象名称禁止使用 MySQL 保留关键字[设计表后逐一排查] 所有表必须使用 Innodb 存储引擎,数据库和表的字符集统一使用 ...

  4. 什么是App推广技术?

    在移动互联网红利消失殆尽.市场竞争日趋激烈的背景下,App的推广越来越难了,如何去有效的进行推广,吸引更多的用户流量,成为了众多互联网企业最为关注的问题. 而App 推广技术指的就是通过一些技术的方式 ...

  5. 详细的App推广前的准备工作

    App开发完成后,推广App自然就成为下一步工作的重点.兵马未动,粮草先行,这里为大家整理了一份App推广前需要准备一些事项,希望能给正在准备开展App推广的小伙伴们一些帮助. 众所周知,App推广的 ...

  6. C++基础之IO类

    下面是IO类的继承关系: ifstream和istringstream都继承自istream.因此,我们可以在传递istream对象的地方传递ifstream和istringstream. 例如:对i ...

  7. JavaScript DOM 编程艺术

    最近把JavaScript DOM 编程艺术这本书看完了,觉得这本书很好 深入浅出地展示了渐进增强.平稳退化.结构和样式分离等编程思想,我对书中重要的知识进行了梳理总结. 一.网页 二.JavaScr ...

  8. 基于操作系统原理的Linux的内存管理

    一.实验目的 1.理解虚拟内存.磁盘缓存的概念. 2.掌握基本的内存管理知识. 3.掌握查看实时查看内存.内存回收的方法 二.实验内容 1. 监控内存使用情况 2. 检查和回收内容 三.实验平台 1. ...

  9. 用深度学习做命名实体识别(六)-BERT介绍

    什么是BERT? BERT,全称是Bidirectional Encoder Representations from Transformers.可以理解为一种以Transformers为主要框架的双 ...

  10. beego之操作model

    beego之操作model 1.环境配置 1>.下载安装orm go get github.com/astaxie/beego/orm 默认安装路径在gopath路径下,可使用go env查看路 ...