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

如下图,

首先进入路由器的命令视图,(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. 实现一个extend函数

    NOW,今天让我们来实现一个extend函数. 具体思路: 使用Object.defineProperty()对属性的特性进行设置,然后通过Object.getOwnPropertyDescripto ...

  2. Python 开发植物大战僵尸游戏

    作者:楷楷 链接:https://segmentfault.com/a/1190000019418065 开发思路 完整项目地址: https://github.com/371854496/pygam ...

  3. SQL手工注入进阶篇

    0.前言 上一篇我们介绍了SQL手工注入的流程以及步骤,但在实际的安全问题以及CTF题目中,查询语句多种多样,而且是肯定会对用户的输入进行一个安全过滤的,而这些过滤并不一定是百分百安全的,如何利用一些 ...

  4. 【Jenkins持续集成(一)】SonarQube 入门安装使用教程

    一.前言 持续集成管理平台不只是CI服务器,是一系列软件开发管理工具的组合. 源码版本管理:svn.git 项目构建工具:Maven.Ant 代码质量管理:Sonar(Checkstyle.PMD.F ...

  5. mysql集群基于docker 在centos上

    新博客https://blog.koreyoshi.work/ mysql集群(PXC)基于docker 在centos上 常用设计方案 Replication(复制) 速度快 弱一致性 低价值 场景 ...

  6. 利用IntelliJ IDEA与Maven开发scala程序,并打包提交到spark集群

    https://zhuanlan.zhihu.com/p/23141509 https://blog.csdn.net/u011470552/article/details/54564636 http ...

  7. 更改hadoop集群yarn的webui中的开始时间和结束时间为本地时间

    yarn集群的webui地址为:http://rm:8088 执行任务后,任务的开始时间和结束时间都是utc时间,查看很不方便. 查找相关资料发现hadoop有补丁包,补丁地址:https://iss ...

  8. P3515 [POI2011]Lightning Conductor

    首先进行一步转化 $a_j \leq a_i + q - sqrt(abs(i - j))$ $a_i + q \geq a_j + sqrt(abs(i-j))$ 即 $q = max (a_j + ...

  9. WebGL简易教程(七):绘制一个矩形体

    目录 1. 概述 2. 示例 2.1. 顶点索引绘制 2.2. MVP矩阵设置 2.2.1. 模型矩阵 2.2.2. 投影矩阵 2.2.3. 视图矩阵 2.2.4. MVP矩阵 3. 结果 4. 参考 ...

  10. dede tag标签静态化

    看回那2个文件夹即可,txt说明书我已经修改过. 下面说一下tag标签静态化之后在内容页.列表页中如何使用. 内容页中沿用之前的方法即可: {dede:tag sort='new' getall='0 ...