华为路由器基本命令

使用路由器AR22220

更改路由器名称

#从用户视图切换到系统视图
sys
#设置名称
sysname R1

配置接口ip

#从用户视图切换到系统视图
sys
#换到接口视图
int g0/0/0
#配置ip
int add 192.168.0.1 24
#查看当前接口ip
display this
#删除接口ip
undo ip address 192.168.0.1 24

查询所有接口ip

display ip interface brief

ipv6

配置接口ip

#切换到系统视图
sys
#开启ipv6功能
ipv6
#换到接口视图
int g0/0/0
#开启接口ipv6功能
ipv6 en
#配置ip
ipv6 add 12::1 64
#按照eui64规则自动生成ip
ipv6 add 13:: 64 eui-64
#配置任意播地址
ipv6 add 2222::2 64 anycast
#查看接口地址
display this
#进入环回地址接口视图
int lo 1
#开启接口ipv6功能
ipv6 en
#配置ip
ipv6 add 1111:1 128
display this
#返回上级
q

手动配置链路本地地址

ipv6 address auto link-loacl

常用查询

#查询所有接口ipv6
dis ipv6 int b
#查询接口ipv6详细信息
dis ipv6 int g0/0/0
#查看ipv6路由表
dis ipv6 routing-table
#查看ipv6邻居mac
dis ipv6 neighbors
#查看ospf邻居
dis ospfv3 peer

测试icmpv6

ping ipv6 12::1

打开无状态地址自动配置功能

sys
int g0/0/0
#ra:route advertisement 路由器通告,通告网络前缀、网关等信息
undo ipv6 nd ra halt
#配置ra包发送速度
ipv6 nd ra min-interval 3
ipv6 nd ra max-interval 4

路由配置

#配置静态路由
ipv6 route-static 2018:: 64 12::1
#查看ipv6路由表
dis ipv6 routing-table

DHCPV6

配置duid

#配置duid,默认ll
dhcpv6 duid { ll | llt }
#查看duid
dis dhcpv6 duid

地址池配置

sys
#开启dhcp功能
dhcp en
#创建并配置ipv6地址池
dhcpv6 pool name1
#配置网络和前缀
add prefix 2018::/64
#配置排除地址池
excluded-address 2018::1
excluded-address 2018::3 to 2018::30
#配置DNS服务器
dns-server 3000::1
#配置域名后缀
dns-domain-name name1.com
#查看配置
d th
display this

配置M,O位

sys
int g0/0/1
#配置M置位,默认0,1为使用全部使用dhcpv6
ipv6 nd autoconfig managed-address-flag
#配置O置位,默认0,1为dns使用dhcpv6
ipv6 nd autoconfig other-flag

接口开启dhcp关联地址池

sys
int g/0/0/1
dhcpv6 server name1

查看dhcpv6地址池

dis dhcpv6 pool

过渡技术--建立隧道


公网R2配置

sys
sys R2
int g0/0/0
ip add 12.0.0.2 24
int g0/0/1
ip add 23.0.0.2 24

R3北京公司出口路由器配置

#配置公网ip
sys
sys R3
int g0/0/1
ip add 12.0.0.1 24
ip route-s 0.0.0.0 0 12.0.0.2
#配置lan口ip和dhcp
sys
ipv6
dhcp en
dhcpv6 pool BJ
address prefix 1::/64
ex 1::1
int g0/0/0
ipv6 en
ipv6 add 1::1 64
dhcpv6 server BJ

R4上海公司出口路由器配置

#配置公网ip
sys
sys R4
int g0/0/1
ip add 23.0.0.32 24
ip route-s 0.0.0.0 0 23.0.0.2
#配置lan口ip和dhcp
sys
ipv6
dhcp en
dhcpv6 pool SH
address prefix 3::/64
ex 3::1
int g0/0/0
ipv6 en
ipv6 add 3::1 64
dhcpv6 server SH

隧道配置

ipv6-ipv4

R3

sys
int tun 0/0/1
#配置协议
tunnel-pro ipv6-ipv4
ipv6 en
#源地址
source 12.0.0.1
#目的地址
destination 23.0.0.32
ipv6 add 13::1 64
#添加路由也可以写出口地址
ipv6 route-static 3:: 64 Tunnel0/0/1

R4

sys
int tun 0/0/1
tunnel-pro ipv6-ipv4
ipv6 en
source 23.0.0.32
destination 12.0.0.1
ipv6 add 13::2 64

ipv6 route-static 1:: 64 Tunnel0/0/1

测试
pc1 ping pc2

PC>ping 3::2

Ping 3::2: 32 data bytes, Press Ctrl_C to break
From 3::2: bytes=32 seq=1 hop limit=253 time=31 ms
From 3::2: bytes=32 seq=2 hop limit=253 time=31 ms
From 3::2: bytes=32 seq=3 hop limit=253 time=16 ms
From 3::2: bytes=32 seq=4 hop limit=253 time=31 ms
gre隧道

gre有扩展包头支持多协议多流量
R3

sys
int tun 0/0/1
#配置协议
tunnel-pro gre
ipv6 en
#源地址
source 12.0.0.1
#目的地址
destination 23.0.0.32
ipv6 add 13::1 64
#添加路由也可以写出口地址
ipv6 route-static 3:: 64 Tunnel0/0/1

R4

sys
int tun 0/0/1
tunnel-pro gre
ipv6 en
source 23.0.0.32
destination 12.0.0.1
ipv6 add 13::2 64

ipv6 route-static 1:: 64 Tunnel0/0/1
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容