路由器静态IP的配置及其备份静态路由缺省路由
静态路由时管理员手动配置并维护的路由。静态路由配置简单,被广泛应用于网络中。静态路由还可以实现负载均衡和路由备份。学习掌握好静态路由的配置是很重要的。
如下图,
首先进入路由器的命令视图,(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的配置及其备份静态路由缺省路由的更多相关文章
- VirtualBox 下 CentOS7 静态 IP 的配置 → 多次踩坑总结,蚌埠住了!
开心一刻 一个消化不良的病人向医生抱怨:我近来很不正常,吃什么拉什么,吃黄瓜拉黄瓜,吃西瓜拉西瓜,怎样才能恢复正常呢? 医生沉默片刻:那你只能吃屎了 环境准备 VirtualBox 6.1 网络连接方 ...
- Ubuntu Server 12.04 静态IP简洁配置
PS:很长时间没使用Ubuntu了,刚才安装个Ubuntu Server 12.04做测试.Ubuntu的网络设置跟Redhat系是不一样的,配置IP时发现跟以前的Ubuntu桌面版本也有所不同,记录 ...
- ubuntn 虚拟机NAT 静态IP 网络配置
在虚拟机安装ubuntu12.04自动获取IP 一切都没有问题 ssh连接也正常.关机重启后郁闷的发现网络已经不通了,于是开始了以下的摸索. 1.配置静态IP 网关: ip段: 命令: Vim /et ...
- 【转】Ubuntu Server 12.04 静态IP简洁配置
原文网址:http://blog.csdn.net/njchenyi/article/details/8715417 1.配置静态IP地址: # vim /etc/network/interfaces ...
- Ubuntu Server 12.04(14.04) 静态IP简洁配置
1.配置静态IP地址: # vim /etc/network/interfaces 原内容有如下4行:auto loiface lo inet loopback auto eth0iface eth0 ...
- 虚拟机设置静态IP与配置网络
不废话,直接上图 一:先配置虚拟机的网络 二:配置win10-VM8网络 三:查看以太网的ip信息,直接在管理员命令中输入 ipconfig /all可以到连接信息 四:如果在上面找不到VM8的网络信 ...
- centos7 安装后静态ip的配置
centos7 想到于centos6.5来说界面上看起来更加炫一点,但是在配置静态ip上来说是差不多的 首先看一下centos7的安装界面,相对来说简洁好看一些 先打开终端 可以看到centos7默认 ...
- VMWare虚拟机NAT模式静态IP联网配置
1.网络连接 vmnet8右键属性ipv4,设置ip为192.168.10.100.如下图: 2.设置虚拟机的网络适配器采用NAT模式 3.vmware工具栏的编辑->虚拟网络编辑器 ...
- Hyper-V 下linux虚拟机静态IP上网配置的两种方式(2)
工作需要,搭建linux环境,网上搜了两种Hyper-V配置linux静态IP及上网的方式,记录一下,方便查阅,如下设置网络共享方式: win10下使用hyper-v在本机安装linux虚拟机后,网络 ...
随机推荐
- python函数练习
1:下载一首英文的歌词或文章 love story-taylor swiftwe were both young when i first saw youi close my eyes and the ...
- 在命令行已经pip install flask-script,但是导包时出错
问题:(已经安装好了flask-script,但是导入不成功) 然后在代码中导入相应的包:(报红) 后来发现是在自己创建项目的时候勾选的是创建的是在虚拟环境下的项目,所以环境有问题 所以我应该在虚拟环 ...
- CoDeSys
CoDeSys是全球最著名的PLC内核软件研发厂家德国的3S(SMART,SOFTWARE,SOLUTIONS)公司出的一款与制造商无关的IEC 61131-1编程软件.CoDeSys 支持完整版本的 ...
- 基于RMAN搭建DataGuard,使用Broker管理DataGuard
一.环境准备 1.数据库软件准备 (1).在主节点,安装单机数据库软件并创建数据库. (2).在备库, 安装单机数据库软件, 但是不创建数据库. 2.操作系统配置 在/etc/hosts下面配置主机名 ...
- [翻译] ASP.NET Core 3.0 的新增功能
ASP.NET Core 3.0 的新增功能 全文翻译自微软官方文档英文版 What's new in ASP.NET Core 3.0 本文重点介绍了 ASP.NET Core 3.0 中最重要的更 ...
- 前台提交数据到node服务器(get方式)
.有两种办法,一种是表单提交,一种是ajax方式提交. 1.form提交 在前台模板文件上写: <form action="/reg" method="get&q ...
- Pandas对缺失值的处理
Pandas使用这些函数处理缺失值: isnull和notnull:检测是否是空值,可用于df和series dropna:丢弃.删除缺失值 axis : 删除行还是列,{0 or 'index', ...
- 暑期——第四周总结(Ubuntu系统安装新版eclipse双击无法打开问题 【已解决】)
所花时间:7天 代码行:200(python)+3000(java) 博客量:1篇 了解到知识点 : Ubuntu安装新eclipse 在通过软件中心安装好eclipse之后,发现各种东西都不顺眼,不 ...
- Android Studio [ListView]
ListViewActivity.java package com.xdw.a122.listview; import android.app.Activity; import android.os. ...
- Spring MVC-从零开始-第一个控制器(不考虑命名规范)
1.目录结构 (log4j.properties.mybatis-config.xml可忽略) 2.配置web.xml文件 <?xml version="1.0" encod ...