首页 > 其他分享 >华为路由器配置IPV4和IPV6局域网示例

华为路由器配置IPV4和IPV6局域网示例

时间:2024-10-08 19:50:43浏览次数:8  
标签:GigabitEthernet0 R1 示例 32 time bytes IPV4 ms IPV6

设计架构图及IP地址如下:PC1和PC2通过DHCP和DHCPV6获取IPV4和IPV6地址,实现图内的所有设备IPV4和IPV6全部互通。

1、IPV4 配置:

R2配置:
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R2
[R2]interface GigabitEthernet 0/0/0
    
[R2-GigabitEthernet0/0/0]ip address 1.1.1.2 255.255.255.0
Aug 29 2024 08:55:40-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]

R2配置静态路由
[R2]ip route-static 192.168.0.0 255.255.0.0 1.1.1.1


R1配置:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
    
[R1]interface GigabitEthernet 0/0/0

[R1-GigabitEthernet0/0/0]ip address 1.1.1.1 255.255.255.0
[R1-GigabitEthernet0/0/0]
Aug 29 2024 08:57:00-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP 
on the interface GigabitEthernet0/0/0 has entered the UP state.
[R1-GigabitEthernet0/0/0]interface G0/0/1
[R1-GigabitEthernet0/0/1]ip addr 192.168.1.254 255.255.255.0
Aug 29 2024 08:57:54-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP 
on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]interface G0/0/2
[R1-GigabitEthernet0/0/2]ip addr 192.168.2.254 255.255.255.0
Aug 29 2024 08:58:17-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]

R1配置静态路由:
[R1]ip route-static 1.1.1.0 255.255.255.0  1.1.1.2

R1:配置DHCPV4
[R1]dhcp enable
[R1]ip pool 1 
Info: It's successful to create an IP address pool.

[R1-ip-pool-1]network 192.168.1.0 mask 255.255.255.0
    
[R1-ip-pool-1]gateway-list 192.168.1.254 
    
[R1-ip-pool-1]dns-list 223.5.5.5 119.29.29.29
    


[R1-ip-pool-1]excluded-ip-address 192.168.1.200 192.168.1.253

[R1]ip pool 2
Info: It's successful to create an IP address pool.
[R1-ip-pool-2]network 192.168.2.0 mask 255.255.255.0
[R1-ip-pool-2]gateway-list 192.168.2.254

[R1-ip-pool-2]dns-list 119.29.29.29 223.5.5.5


[R1-ip-pool-2]excluded-ip-address 192.168.2.200 192.168.2.253

[R1]interface GigabitEthernet 0/0/1
    
[R1-GigabitEthernet0/0/1]dhcp select global
    
[R1-GigabitEthernet0/0/1]interface G0/0/2
    
[R1-GigabitEthernet0/0/2]dhcp select global 


查看PC1和PC2的地址:
PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29
PC>ipconfig

Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29

PC1和PC2互通:
PC>ping 192.168.2.199

Ping 192.168.2.199: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 192.168.2.199: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.2.199: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.2.199: bytes=32 seq=4 ttl=127 time=16 ms
From 192.168.2.199: bytes=32 seq=5 ttl=127 time=15 ms

PC>ping 192.168.1.199

Ping 192.168.1.199: 32 data bytes, Press Ctrl_C to break
From 192.168.1.199: bytes=32 seq=1 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=2 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=3 ttl=127 time=15 ms
From 192.168.1.199: bytes=32 seq=4 ttl=127 time=16 ms
From 192.168.1.199: bytes=32 seq=5 ttl=127 time=15 ms

PC1和PC2和R2互通:
PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: bytes=32 seq=1 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=2 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=3 ttl=254 time=31 ms
From 1.1.1.2: bytes=32 seq=4 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=5 ttl=254 time=15 ms

PC>ping 1.1.1.2

Ping 1.1.1.2: 32 data bytes, Press Ctrl_C to break
From 1.1.1.2: bytes=32 seq=1 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=2 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=3 ttl=254 time=31 ms
From 1.1.1.2: bytes=32 seq=4 ttl=254 time=16 ms
From 1.1.1.2: bytes=32 seq=5 ttl=254 time=15 ms

<R2>ping 192.168.1.199
  PING 192.168.1.199: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.1.199: bytes=56 Sequence=2 ttl=127 time=40 ms
    Reply from 192.168.1.199: bytes=56 Sequence=3 ttl=127 time=30 ms
    Reply from 192.168.1.199: bytes=56 Sequence=4 ttl=127 time=20 ms
    Reply from 192.168.1.199: bytes=56 Sequence=5 ttl=127 time=20 ms

  --- 192.168.1.199 ping statistics ---
    5 packet(s) transmitted
    4 packet(s) received
    20.00% packet loss
    round-trip min/avg/max = 20/27/40 ms

<R2>ping 192.168.2.199
  PING 192.168.2.199: 56  data bytes, press CTRL_C to break
    Request time out
    Reply from 192.168.2.199: bytes=56 Sequence=2 ttl=127 time=10 ms
    Reply from 192.168.2.199: bytes=56 Sequence=3 ttl=127 time=30 ms
    Reply from 192.168.2.199: bytes=56 Sequence=4 ttl=127 time=30 ms

  --- 192.168.2.199 ping statistics ---
    4 packet(s) transmitted
    3 packet(s) received
    25.00% packet loss
    round-trip min/avg/max = 10/23/30 ms

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

2、IPV6配置:

R2配置:
[R2]ipv6 
[R2]interface GigabitEthernet 0/0/0
[R2-GigabitEthernet0/0/0]ipv6 enable
    
[R2-GigabitEthernet0/0/0]ipv6 address 2001::1 64
[R2-GigabitEthernet0/0/0]
Aug 29 2024 09:16:32-08:00 R2 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=50331648, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/0 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R2-GigabitEthernet0/0/0]
Aug 29 2024 09:16:32-08:00 R2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPv
6 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R2-GigabitEthernet0/0/0]

R2配置IPV6默认路由:
[R2]ipv6 route-static 2002:: 64 2001::2
[R2]ipv6 route-static 2003:: 64 2001::2

R1配置:
[R1]ipv6
[R1]interface G0/0/0
[R1-GigabitEthernet0/0/0]ipv6 enable
[R1-GigabitEthernet0/0/0]ipv6 addr 2001::2/64
[R1-GigabitEthernet0/0/0]
Aug 29 2024 09:20:22-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=50331648, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/0 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/0]
Aug 29 2024 09:20:22-08:00 R1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IPv
6 on the interface GigabitEthernet0/0/0 has entered the UP state. 
[R1-GigabitEthernet0/0/0]
[R1-GigabitEthernet0/0/0]interface G0/0/1

[R1-GigabitEthernet0/0/1]ipv6 enable
[R1-GigabitEthernet0/0/1]ipv6 addr 2002::1/64
[R1-GigabitEthernet0/0/1]
Aug 29 2024 09:21:35-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=67108864, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/1 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/1]
Aug 29 2024 09:21:35-08:00 R1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IPv
6 on the interface GigabitEthernet0/0/1 has entered the UP state. 
[R1-GigabitEthernet0/0/1]
[R1-GigabitEthernet0/0/1]int G0/0/2
[R1-GigabitEthernet0/0/2]ipv6 enable
[R1-GigabitEthernet0/0/2]ipv6 addr 2003::1/64
[R1-GigabitEthernet0/0/2]
Aug 29 2024 09:22:29-08:00 R1 IPV6/2/IF_IPV6CHANGE:OID 16777216.50331648.1006632
96.16777216.33554432.16777216.922746880.33554432.0.16777216 The status of the IP
v6 Interface changed. (IfIndex=83886080, IfDescr=HUAWEI, AR Series, GigabitEther
net0/0/2 Interface, IfOperStatus=16777216, IfAdminStatus=16777216) 
[R1-GigabitEthernet0/0/2]
Aug 29 2024 09:22:29-08:00 R1 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IPv
6 on the interface GigabitEthernet0/0/2 has entered the UP state. 
[R1-GigabitEthernet0/0/2]

R1配置静态路由:
[R1]ipv6 route-static  2001:: 64  2001::1


R1配置DHCPV6
[R1]dhcpv6 pool 1

[R1-dhcpv6-pool-1]address prefix 2002::/64

[R1-dhcpv6-pool-1]dns-server 2002::1

[R1-dhcpv6-pool-1]excluded-address 2002::1 to 2002::10

[R1]dhcpv6 pool 2
    
[R1-dhcpv6-pool-2]address prefix 2003::/64

[R1-dhcpv6-pool-2]dns-server 2003::1

[R1-dhcpv6-pool-2]excluded-address 2003::1 to 2003::10

配置R1路由器G1和G2接口IPV6配置:
[R1-dhcpv6-pool-2]int g0/0/1



[R1-GigabitEthernet0/0/1]dhcpv6 server  1
[R1-GigabitEthernet0/0/1] undo ipv6 nd ra halt

[R1-GigabitEthernet0/0/1] ipv6 nd autoconfig managed-address-flag

[R1-GigabitEthernet0/0/1] ipv6 nd autoconfig other-flag

[R1-dhcpv6-pool-2]int g0/0/2



[R1-GigabitEthernet0/0/2]dhcpv6 server 2
[R1-GigabitEthernet0/0/2] undo ipv6 nd ra halt

[R1-GigabitEthernet0/0/2] ipv6 nd autoconfig managed-address-flag

[R1-GigabitEthernet0/0/2] ipv6 nd autoconfig other-flag

至此配置完毕,测试PC1和PC2与AR2的联通性。

PC1:
Link local IPv6 address...........: fe80::5689:98ff:fe81:39d0
IPv6 address......................: 2002::11 / 128
IPv6 gateway......................: fe80::2e0:fcff:fe14:1f1f
IPv4 address......................: 192.168.1.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.1.254
Physical address..................: 54-89-98-81-39-D0
DNS server........................: 223.5.5.5
                                    119.29.29.29

 PC2:
Link local IPv6 address...........: fe80::5689:98ff:fe2f:74d8
IPv6 address......................: 2003::11 / 128
IPv6 gateway......................: fe80::2e0:fcff:fe14:1f20
IPv4 address......................: 192.168.2.199
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.2.254
Physical address..................: 54-89-98-2F-74-D8
DNS server........................: 119.29.29.29
                                    223.5.5.5

PC1-PC2
PC>ping 2003::11

Ping 2003::11: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 2003::11: bytes=32 seq=2 hop limit=254 time=31 ms
From 2003::11: bytes=32 seq=3 hop limit=254 time=16 ms
From 2003::11: bytes=32 seq=4 hop limit=254 time=15 ms
From 2003::11: bytes=32 seq=5 hop limit=254 time=16 ms

PC>ping 2002::1

Ping 2002::1: 32 data bytes, Press Ctrl_C to break
From 2002::1: bytes=32 seq=1 hop limit=64 time=15 ms
From 2002::1: bytes=32 seq=2 hop limit=64 time=16 ms
From 2002::1: bytes=32 seq=3 hop limit=64 time=16 ms
From 2002::1: bytes=32 seq=4 hop limit=64 time=15 ms
From 2002::1: bytes=32 seq=5 hop limit=64 time=31 ms

PC和AR2
PC>ping 2001::1

Ping 2001::1: 32 data bytes, Press Ctrl_C to break
Request timeout!
From 2001::1: bytes=32 seq=2 hop limit=63 time=32 ms
From 2001::1: bytes=32 seq=3 hop limit=63 time=16 ms
From 2001::1: bytes=32 seq=4 hop limit=63 time=16 ms
From 2001::1: bytes=32 seq=5 hop limit=63 time=31 ms

PC>ping 2001::1

Ping 2001::1: 32 data bytes, Press Ctrl_C to break
From 2001::1: bytes=32 seq=1 hop limit=63 time=15 ms
From 2001::1: bytes=32 seq=2 hop limit=63 time=32 ms
From 2001::1: bytes=32 seq=3 hop limit=63 time=31 ms
From 2001::1: bytes=32 seq=4 hop limit=63 time=15 ms
From 2001::1: bytes=32 seq=5 hop limit=63 time=32 ms

<R2>ping ipv6 2002::11
  PING 2002::11 : 56  data bytes, press CTRL_C to break
    Reply from 2002::11 
    bytes=56 Sequence=1 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=2 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=3 hop limit=254  time = 20 ms
    Reply from 2002::11 
    bytes=56 Sequence=4 hop limit=254  time = 30 ms
    Reply from 2002::11 
    bytes=56 Sequence=5 hop limit=254  time = 20 ms

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

标签:GigabitEthernet0,R1,示例,32,time,bytes,IPV4,ms,IPV6
From: https://blog.csdn.net/modaner/article/details/142767822

相关文章

  • GUI无代码小示例 - 工作流连线实现0/1连续翻转
    效果如下所示,连续点击按钮,输出0、1、0、1...。  步骤新建页面,拖入组件拖入3个组件:数学计算、输入框、按钮。如下所示: 连线和配置按钮点击→函数执行 1减去输入,作为函数输出这样,当首次执行时,默认操作数1将减去输入的1,输出0。 函数输出......
  • 第二百七十一节 JPA教程 - JPA查询like Escape示例
    JPA教程-JPA查询likeEscape示例如果模式字符串包含应匹配的下划线或百分号,则ESCAPE子句可以使用\指定转义字符:SELECTdFROMDepartmentdWHEREd.nameLIKE'QA\_%'ESCAPE'\' 例子下面的代码来自PersonDaoImpl.java。packagecn.w3cschool.common;importjava.......
  • 最简单的示例:通过JDBC查询数据
    引言在现代企业级应用开发中,持久层框架(如MyBatis、Hibernate等)极大地简化了数据库操作,提高了开发效率和代码的可维护性。本文将通过一个最简单的示例,演示如何使用JDBC连接数据库、执行SQL语句以及处理结果,并与Mybatis源码做对比,为后续深入研究MyBatis源码打下基础......
  • 织梦数据库配置一个典型的 common.inc.php 文件中的数据库配置示例
    <?php//数据库配置$cfg_dbhost='localhost';//数据库服务器地址$cfg_dbport=3306;//数据库端口$cfg_dbase='your_database_name';//数据库名称$cfg_dbuser='your_username';//数据库用户名$cfg_dbpw='your_password';......
  • 分页使用示例
    1.代码classUserModelSerializer(serializers.ModelSerializer):role_display=UserRoleSerializer(many=True,source='roles',read_only=True)classMeta:model=models.Userfields=["id","username",&#......
  • 鸿蒙应用示例:镂空效果实现教程
    在鸿蒙系统中,为了给用户带来更加生动的视觉体验,我们可以使用不同的技术手段来实现图像和文字的镂空效果。本文将通过三个具体的示例来展示如何在鸿蒙系统中实现实心矩形镂空、实心圆镂空以及文字镂空的效果。示例代码//定义一个名为Index的应用入口组件@Entry@Componentstruct......
  • DataInOut 文件输入输出示例
    publicclassDataInOutTest{publicstaticvoidmain(String[]args){DataOutputStreamdos=null;DataInputStreamdis=null;FileInputStreamfis=null;FileOutputStreamfos=null;try{fis=newFileInp......
  • 鸿蒙应用示例:实现文本高亮与自动换行
    在设计应用界面时,我们常常需要对某些重要的文本进行高亮显示,以引起用户的注意。同时,在一些场景中,我们需要确保长文本能够自动换行,以适应不同的屏幕尺寸和布局需求。本文将通过两个示例,分别展示如何在HarmonyOS应用中实现这些功能。【示例一】文本高亮显示@Entry@Componentstruct......
  • 鸿蒙应用示例:ArkTS中设置颜色透明度与颜色渐变方案探讨
    /***根据比例混合两个十六进制颜色值。*@paramcolorA第一个颜色的十六进制值,例如红色'#ff0000'。*@paramcolorB第二个颜色的十六进制值,例如黑色'#000000'。*@paramratio混合比例,0表示仅返回colorA,1表示仅返回colorB,介于0和1之间的值会混合两个颜色。......
  • 鸿蒙应用示例:应用开发中的动态获取属性与调用方法技巧
    随着HarmonyOS的发展,API版本的更新带来了许多新的特性和限制。在API11及以后的版本中,直接赋值对象的语法不再被支持,这要求开发者们采用新的方式来处理对象的创建和属性的访问。同时,HarmonyOS支持ETS(EnhancedTypeScript)文件,这是一种扩展了TypeScript的文件格式,用于更好地支持Harmo......