华为路由交换基础及常用配置命令梳理

更新时间:2023-07-07 20:33:12 阅读: 评论:0

华为路由交换基础及常⽤配置命令梳理1. IP地址与⼦⽹划分/路由汇总
1.1 IP地址分类
  共分为A.B.C.D.E五类:
类别地址范围⼆进制表⽰范围
单个⼦⽹可
的主机数
(除0⽹段地
和1⼴播之
外)
A
富春桃源1-126 (1.0.0.1-126.255.255.254可⽤)
127.0.0.1属于环回地址,保留⽤于测试,不能被分配使⽤
10.0.0.0-10.255.255.255是私⽹地址00000001-
01111110
2**24-2=
16777214
B 128-191 (128.0.0.1-191.255.255.254可⽤)
172.16.0.0-172.31.255.255是私⽹地址
169.254.X.X保留⽤于找不到可⽤DHCP服务器时分配
使⽤
10000000-
10111111
2**16-2=
65534
C
192-223 (192.0.0.1-223.255.255.254可⽤) 192.168.0.0-192.168.255.255是私⽹地址11000000-
11011111
2**8-2=
254
D224-239 (224.0.0.1-239.255.255.254)组播11100000-11101111
E240-255 (240.0.0.1-255.255.255.254)保留11110000-11111111
1.2 ⼗进制数与⼆进制数之间的转换⽰例记忆
1.3 等长⼦⽹划分FLSM
  ⽅法:
  1)确定⼦⽹掩码
  2) 确定⽹段中的第⼀个可⽤ip地址及⽹段最后⼀个可⽤地址
  3)如果⼀个⼦⽹段是原来⽹络的1/2,则⼦⽹掩码往后移1位;如果⼀个⼦⽹段是原来⽹络的1/4,则⼦⽹掩码往后移2位;如果⼀个⼦⽹段是原来⽹络的1/8,则⼦⽹掩码往后移3位,以此类推.  实例演⽰记忆:
1.4 变长⼦⽹划分VLSM ⽰例记忆
1.5 路由汇总⽰例记忆猴子用英语怎么写
  注意:如果某⼀个⽹段的⼦⽹掩码⽐默认的⼦⽹掩码长,就是其下属的⼦⽹;如果该⼦⽹的⼦⽹掩码⽐默认的⼦⽹掩码要短,则是超⽹supernet.
  路由汇总的实质是将⼦⽹进⾏与运算,得到相同的⽹络部位.可以使⽤以下⽰例记忆:
2. TCP/IP协议栈重要知识点
  共分4层:应⽤层-----传输层-----Internet⽹络层-----⽹络接⼝层
2.1 传输层协议⾸部内容
2.2 ⽹络层协议⾸部内容
3. 华为数通产品基本配置
3.1 命令视图分类
  ⽤户视图:查看运⾏状态及其他信息等.
  系统视图:配置设备的系统参数及全局相关参数.
  接⼝视图:配置接⼝相关参数.
  协议视图:配置路由协议相关.
3.2 设置路由器时间和名称
<Huawei>system-view      #进⼊系统视图命令
[Huawei]sysname R1  #sysname更改路由器的名字
[R1]
<R1>display version  #显⽰操作系统版本
<R1>?                    #查看可⽤命令
<R1>display clock  #显⽰时间
<R1>clock timezone BJ add 08:00 #更改时区
<R1>clock datetime 22:36:54 2019-10-17 #设置时间
<R1>display clock
2019-10-17 22:36:58
Thursday
Time Zone(BJ) : UTC+08:00
# 设置设备当前⽇期和时间为2012年1⽉1⽇0时0分0秒。格式如下
<Huawei> clock datetime 0:0:0 2012-01-01
# 设置时区
<Huawei> clock timezone BJ add 08:00:00
3.3 配置路由接⼝IP地址 
  注意:路由器上的交换模块接⼝,默认都属于vlanif1,且交换模块不可配置直接配置IP地址,需把接⼝加⼊vlanif_ID.   AR路由器上路由和交换模块的逻辑图如下:
  配置命令⽰例:
[R1]interface Vlanif 1
[R1-Vlanif1]ip address 192.168.1.254 24
[R1-Vlanif1]ip address 192.168.2.254 24 sub  #配置第⼆个ip地址,注意要不同⽹段
[R1-Vlanif1]undo ip address 192.168.2.254 24 sub #删除IP地址
[R1-Vlanif1]undo shutdown
[R1]interface Ethernet 0/0/0
[R1-Ethernet0/0/0]port link-type access      #指定以太⽹接⼝是接计算机的
3.4 华为数通产品命令分级及⽤户等级说明 
3.5 配置⽤户通过console⼝和telnet接⼊
  配置console⼝:
[R1]ur-interface console 0
[R1-ui-console0]authentication-mode password
Plea configure the login password (maximum length 16):123456  #输⼊密码即是登陆密码
[R1-ui-console0]idle-timeout 5  #设置超时时间为5分钟
[R1-ui-console0]display this  #显⽰单个接⼝的具体配置信息
[V200R003C00]
#
ur-interface con 0
authentication-mode password
t authentication password cipher %$%$8hQgDg@_5</g\!.Y28kT,$!_:={c8ZQ_P**B;s0o
m@tR$!b,%$%$
ur-interface vty 0 4
ur-interface vty 16 20
箱型梁#
return
>####重设console⼝的密码
Password:
<R1>system-view
Enter system view, return ur view with Ctrl+Z.
[R1]ur-interface console 0
[R1-ui-console0]t authentication password cipher 123  #重设为123
[R1-ui-console0]undo authentication-mode  #不设置密码,清空密码认证
  配置telnet(⾮加密端⼝,传输层协议tcp+23):
<R1>system-view
Enter system view, return ur view with Ctrl+Z.
[R1]telnet rver enable                      #使能Telnet服务器功能
风筝的制作方法[R1]telnet rver port 23                    #配置Telnet服务器端⼝号
[R1]ur-interface vty 0 4
[R1-ui-vty0-4]ur privilege level 4
[R1-ui-vty0-4]undo ur privilege level        #还原缺省值级别命令
[R1]ur-interface ?
INTEGER<0,129-149>  The first ur terminal interface to be configured
console              Primary ur terminal interface  #超级终端
current              The current ur terminal interface
maximum-vty          The maximum number of VTY urs, the default value is 5
tty                  The asynchronous rial ur terminal interface
vty                  The virtual ur terminal interface  #虚拟接⼝
[R1]ur-interface vty 0 4  #0 4意思是最⼤允许同时0,1,2,3,4共5个⼈telnet链接
[R1-ui-vty0-4]authentication-mode password  #注意这是单单console⼝的密码
Plea configure the login password (maximum length 16):123456
[R1-ui-vty0-4]idle-timeout 2  #设置超时时间
[R1-ui-vty0-4]ur privilege level 15  #设置telnet登录进来的等级
[R1-ui-vty0-4]undo ur privilege level 15 #取消等级
[R1-ui-vty0-4]t authentication password cipher 123  #重设密码为123
<R1>display urs    #查看链接到路由器的⽤户,或下⾯也是⼀样的
<R1>display ur-interface
3.6 配置AAA验证 
  配置⽤户名和密码验证(即 AAA ,authentication⾝份验证,authorization授权验证,accounting账户记账)步骤:
  1)进⼊aaa模式创建⽤户名和密码.
  2)指定此⽤户进⾏哪⼀种服务的aaa验证(默认admin存在).
  3)进⼊接⼝模式(console或telnet虚拟接⼝),指定验证模式为aaa. 
<R1>system-view
Enter system view, return ur view with Ctrl+Z.
[R1]aaa
[R1-aaa]local-ur test password cipher 123456  #增加⽤户和设置加密的密码
Info: Add a new ur.
[R1-aaa]local-ur test privilege level 15  #设置test⽤户级别
[R1-aaa]local-ur test rvice-type ?    #查看⽤户可⽤的验证类型接⼊⽅式
8021x    802.1x ur
bind      Bind authentication ur
ftp      FTP ur
http      Http ur
枳术宽中胶囊ppp      PPP ur
ssh      SSH ur
sslvpn    Sslvpn ur
telnet    Telnet  ur
terminal  Terminal ur
web      Web authentication ur
x25-pad  X25-pad ur
[R1-aaa]local-ur test rvice-type telnet  #指定⽤户可以使⽤telnet和console,取消都是使⽤undo
[R1-aaa]local-ur test rvice-type terminal    #注意,同时配置console和telnet使⽤aaa验证,可能只有⼀个⽣效
[R1-aaa]display local-ur
----------------------------------------------------------------------------
Ur-name                      State  AuthMask  AdminLevel
----------------------------------------------------------------------------
test                          A      M        15
admin                          A      H        -          #<===缺省已经存在⼀个admin⽤户允许进⾏aaa验证
----------------------------------------------------------------------------
Total 2 ur(s)
3.7 配置⽤户通过web⽅式登录管理华为数通设备
<Huawei> system-view
[Huawei] interface gigabitethernet 0/0/0
[Huawei-GigabitEthernet0/0/0] ip address 10.0.0.1 24
[Huawei-GigabitEthernet0/0/0] quit
[Huawei] aaa    #配置aaa认证
[Huawei-aaa] local-ur admin password irreversible-cipher 123456
[Huawei-aaa] local-ur admin privilege level 15
[Huawei-aaa] local-ur admin rvice-type http
[Huawei-aaa] quit
[Huawei] http rver enable  #使能http⽹管功能
[Huawei] quit    #输⼊接⼝IP地址即可登录,如10.0.0.1
<Huawei> display http rver  #查看信息
4. 静态路由
  ⽹络畅通的条件:数据包有去有回.
  路由器上2张重要的表: 路由表和转发表.
[Huawei]display ip routing-table          #显⽰所有路由表
[Huawei]display fib        #显⽰FIB表信息
4.1 华为路由器静态路由常⽤配置命令 
  使⽤静态路由协议,路由器需要知道除⾃⼰直连的⽹段的路由外的所有路由表怎么⾛,才能让数据包有去有回.没有直连的⽹段,需⼿⼯添加静态路由表.
# 配置路由器使⽤IP地址作为下⼀跳地址静态路由
[Huawei]ip route-static 192.168.6.0 255.255.255.0 192.168.4.1 #下⼀跳地址是192.168.4.1
[Huawei]display ip routing-table  #显⽰所有路由表
[Huawei]display ip routing-table protocol static #仅仅显⽰静态路由表
[Huawei]undo ip route-static 192.168.4.1  #删除路由表不⽤加下⼀跳地址
# 使⽤路由器的出接⼝地址接⼝号作为路由器下⼀跳的地址(串⼝/⼴域⽹接⼝最好使⽤接⼝编号作为下⼀条地址,以太⽹最好使⽤IP地址作为下⼀跳,节省查询路由表的开销),rial串⼝/⼴域⽹接⼝是点到点链路,使⽤ppp封[Huawei]ip route-static 172.16.1.0 24 rial 2/0/0    #指定路由器的出接⼝为下⼀跳地址
[Huawei]display ip routing-table          #显⽰所有路由表
  配置主机路由:主机路由指定的特定的主机地址,⼦⽹掩码是全1,即255.255.255.255 
[Huawei]ip route-static 192.168.2.1 32 172.168.2.1
[Huawei]display fib
[Huawei]display ip routing-table
4.2 静态路由之默认路由 
  注意:默认路由的优先级是最低的,⼦⽹掩码为1的位越多,优先级越⾼. 
4.3 静态路由之等价路由及浮动路由
  等价路由,转发数据时按照1:1转发. 
[Huawei]ip route-static 192.168.3.0 24 192.168.0.2
[Huawei]ip route-static 192.168.3.0 24 192.168.1.2
[Huawei]display ip routing-table protocol static
  浮动路由:即主备关系,主线断,备线顶上.(值越⼩,优先级越⾼) 
[Huawei]ip route-static 192.168.6.0 24 172.16.0.2 ?
description  Add or delete description of unicast static route
inherit-cost  Inherit the cost of the iterated route
permanent    Specifies route permanent
preference    Specifies route preference
tag          Specifies route tag
track        Specify track object
<cr>          Plea press ENTER to execute command
[Huawei]ip route-static 192.168.6.0 24 172.16.0.2 pre
[Huawei]ip route-static 192.168.6.0 24 172.16.0.2 preference ?
INTEGER<1-255>  Preference value range
[Huawei]ip route-static 192.168.6.0 24 172.16.0.2 preference 120  #设置备⽤路由线路优先级为120
[Huawei]display ip routing-table protocol static    #直连路由优先级最⾼,备⽤路由在主路由表失效时失效
5. 动态路由
5.1 动态路由协议RIP
  RIP协议版本的区别:
  1)RIPv1:通过⼴播⽅式255.255.255.255 FF-FF-FF-FF-FF-FF发现邻居和通告路由表信息;不带⼦⽹掩码,⽀持等长⼦⽹,不⽀持变长⼦⽹,不⽀持路由⼿动汇总;不⽀持认证.
  2)RIPv2:通过多播地址224.0.0.9发现邻居和更新路由表信息;带⼦⽹掩码,⽀持等长和变长⼦⽹,⽀持⼿动路由汇总;⽀持认证,有明⽂和MD5两种认证⽅式 ;
  RIP协议⼏个计时器:
  1)每隔30秒发送更新路由表信息给对⽅.
  2)失效计时器是180秒,跳数超过16跳不可达.
  3)垃圾搜集计时器:失效的路由,过了120秒,从路由表彻底删除.
  常⽤配置命令:
[Huawei]rip 1  #1代表进程ID
[Huawei-rip-1]network 10.0.0.0  #通告本⽹段路由信息
[Huawei-rip-1]network 192.168.1.0
[Huawei-rip-1]version ?
INTEGER<1-2>  Version of RIP process
[Huawei-rip-1]version 2  #使⽤版本2可以使路由表带有更为精确的⼦⽹掩码信息
[Huawei-rip-1]summary always  #默认总是⾃动汇总(接⼝如果启⽤了⽔平分割和毒性逆转需同时执⾏此命令才会⾃动汇总)
[Huawei-rip-1]undo summary    #关闭⾃动汇总,可⽀持不连续⼦⽹
[Huawei]interface GigabitEthernet 0/0/0  #在接⼝视图下进⾏⼿⼯汇总
[Huawei-GigabitEthernet0/0/0]rip summary-address 192.168.10.0 255.255.255.128
<Huawei>display rip 1 route  #显⽰此进程的路由信息
<Huawei>display rip 1 databa  #显⽰rip 1进程数据信息
<Huawei>display ip routing-table protocol rip #查看rip协议学到的路由信息
<Huawei>display rip 1 interface  #查看正在运⾏rip协议的接⼝的相关信息
<Huawei>terminal monitor #查看rip协议活动信息
<Huawei>terminal debugging
<Huawei>debugging rip 1 packet
<Huawei>debugging rip 1 packet GigabiEthernet 0/0/0 #查看接⼝发送和接收的rip数据包
<Huawei>undo debugging all #关闭诊断
5.2 配置RIP认证 
<Huawei> system-view
[Huawei] interface gigabitethernet 1/0/0
[Huawei-GigabitEthernet1/0/0] rip authentication-mode ?  #查看rip协议⽀持的认证⽅式
[Huawei-GigabitEthernet1/0/0] rip authentication-mode hmac-sha256 cipher admin@huawei 255
6. 动态路由
6.1 动态路由OSPF
  ospf:开放式最短优先动态路由协议,针对ipv4使⽤的是ospf VERSION2;针对ospf ipv6使⽤的是ospf VERSION3;ospf⽀持区域. 
  ospf协议的5种报⽂:
  1)问候数据包(hello包),发现并建⽴邻居关系.
  2)数据库描述数据包(databa description),向邻居给出⾃⼰的链路状态数据库中的所有链路状态的摘要信息.
  3)链路状态请求数据包(Link State Request,即LSR).
  4)链路状态更新数据包(Link State Update,即LSU),使⽤泛洪的⽅法对全⽹更新链路状态.此种数据包的信息最复杂,也是ospf最核⼼的部分.路由器使⽤这种数据包将其链路状态信息通告给邻居路由器.在ospf中,只有LSU需要显⽰确认信息.
  5)链路状态确认数据包(Link State Acknonwledegement,LSAck),对LSU进⾏确认.
6.2 ospf配置⽰例
  来源:华为官⽅⽂档.
>RouterA的配置⽂件
#
sysname RouterA
#
router id 1.1.1.1    #<===router id⼀般使⽤路由器的环回地址,且全⽹唯⼀(⼀般需先配置环回接⼝IP地址)
#
interface GigabitEthernet1/0/0
ip address 192.168.0.1 255.255.255.0
#
interface GigabitEthernet2/0/0    #<===接⼝的⽹络类型须⼀致(接⼝视图下查看⽹络类型ospf network-type ?)
ip address 192.168.1.1 255.255.255.0
#
ospf 1        #<===ospf的进程号
肥遁area 0.0.0.0    #<===配置区域id,链路两端的ospf区域id须⼀致
network 192.168.0.0 0.0.0.255
area 0.0.0.1
network 192.168.1.0 0.0.0.255
#
return
>#RouterB的配置⽂件
#
sysname RouterB
#
router id 2.2.2.2
#
interface GigabitEthernet1/0/0
ip address 192.168.0.2 255.255.255.0 #
interface GigabitEthernet2/0/0
ip address 192.168.2.1 255.255.255.0 #
ospf 1
area 0.0.0.0
network 192.168.0.0 0.0.0.255
低碳生活论文
area 0.0.0.2
network 192.168.2.0 0.0.0.255
#
return
>#RouterC的配置⽂件
#
sysname RouterC
#
router id 3.3.3.3
#
interface GigabitEthernet1/0/0
ip address 192.168.1.2 255.255.255.0 #
interface GigabitEthernet2/0/0
ip address 172.16.1.1 255.255.255.0 #
ospf 1
area 0.0.0.1
network 192.168.1.0 0.0.0.255
network 172.16.1.0 0.0.0.255
#
return
>#RouterD的配置⽂件
#
sysname RouterD
#
router id 4.4.4.4
#
interface GigabitEthernet1/0/0
ip address 192.168.2.2 255.255.255.0 #
interface GigabitEthernet2/0/0
ip address 172.17.1.1 255.255.255.0 #
ospf 1
area 0.0.0.2
network 192.168.2.0 0.0.0.255
network 172.17.1.0 0.0.0.255
气馁
#
return
>#RouterE的配置⽂件
#
sysname RouterE
#
router id 5.5.5.5
#
interface GigabitEthernet2/0/0
ip address 172.16.1.2 255.255.255.0 #
ospf 1
area 0.0.0.1
network 172.16.1.0 0.0.0.255
#
return
>#RouterF的配置⽂件
#
sysname RouterF
#
router id 6.6.6.6
#
interface GigabitEthernet2/0/0
ip address 172.17.1.2 255.255.255.0 #
ospf 1
area 0.0.0.2
network 172.17.1.0 0.0.0.255
#
return
  常⽤的查看配置和诊断命令:

本文发布于:2023-07-07 20:33:12,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1084236.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:路由   配置   协议   路由器   信息   路由表   验证   链路
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图