配置接口的IPv6地址示例

 

组网需求

图1所示,SwitchA和SwitchB分别通过10GE1/0/1相连,两台交换机的10GE1/0/1均对应各自的VLANIF100接口,为VLANIF100接口配置IPv6全球单播地址,实现SwitchA和SwitchB互通。

图1 配置IPv6基础功能组网图
配置接口的IPv6地址示例

配置思路

配置IPv6基础功能思路如下:

  1. 交换机接口上使能IPv6功能。
  2. 配置接口的IPv6全球单播地址。

操作步骤

  1. 创建VLAN,并将接口加入到VLAN中 

    # 配置SwitchA。

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchA
    [*HUAWEI] commit
    [~SwitchA] vlan batch 100
    [*SwitchA] interface 10ge 1/0/1
    [*SwitchA-10GE1/0/1] port link-type trunk
    [*SwitchA-10GE1/0/1] port trunk allow-pass vlan 100
    [*SwitchA-10GE1/0/1] quit
    [*SwitchA] commit

    # 配置SwitchB。

    <HUAWEI> system-view
    [~HUAWEI] sysname SwitchB
    [*HUAWEI] commit
    [~SwitchB] vlan batch 100
    [*SwitchB] interface 10ge 1/0/1
    [*SwitchB-10GE1/0/1] port link-type trunk
    [*SwitchB-10GE1/0/1] port trunk allow-pass vlan 100
    [*SwitchB-10GE1/0/1] quit
    [*SwitchB] commit

     

  2. 接口上使能IPv6功能,并配置接口的全球单播地址 

    # 配置SwitchA。

    [~SwitchA] interface vlanif 100
    [*SwitchA-Vlanif100] ipv6 enable
    [*SwitchA-Vlanif100] ipv6 address fc00:1::1/64
    [*SwitchA-Vlanif100] commit
    [~SwitchA-Vlanif100] quit
    [~SwitchA] quit

    # 配置SwitchB。

    [~SwitchB] interface vlanif 100
    [*SwitchB-Vlanif100] ipv6 enable
    [*SwitchB-Vlanif100] ipv6 address fc00:1::2/64
    [*SwitchB-Vlanif100] commit
    [~SwitchB-Vlanif100] quit
    [~SwitchB] quit

     

  3. 验证配置结果 

    如果配置成功,可以查看配置的全球单播地址,以及接口状态为Up,IPv6协议状态为Up,并可以查看接口的邻居情况。

    # 查看SwitchA的接口信息。

    <SwitchA> display ipv6 interface vlanif 100
    Vlanif100 current state : UP
    IPv6 protocol current state : UP
    IPv6 is enabled, link-local address is FE80::C964:0:B8B6:1
      Global unicast address(es):
        FC00:1::1, subnet is FC00:1::/64
      Joined group address(es):
        FF02::1:FF00:1
        FF02::1:FFB6:1
        FF02::2
        FF02::1
      MTU is 1500 bytes
      ND DAD is enabled, number of DAD attempts: 1
      ND reachable time is 1200000 milliseconds
      ND retransmit interval is 1000 milliseconds
      Hosts use stateless autoconfig for addresses

    # 查看SwitchB的接口信息。

    <SwitchB> display ipv6 interface vlanif 100
    Vlanif100 current state : UP
    IPv6 protocol current state : UP
    IPv6 is enabled, link-local address is FE80::2D6F:0:7AF3:1
      Global unicast address(es):
        FC00:1::2, subnet is FC00:1::/64
      Joined group address(es):
        FF02::1:FF00:2
        FF02::1:FFF3:1
        FF02::2
        FF02::1
      MTU is 1500 bytes
      ND DAD is enabled, number of DAD attempts: 1
      ND reachable time is 1200000 milliseconds
      ND retransmit interval is 1000 milliseconds
      Hosts use stateless autoconfig for addresses

    # 从SwitchA上可以Ping通SwitchB的链路本地地址,注意需要使用-i参数,来指定链路本地地址的接口。

    <SwitchA> ping ipv6 FE80::2D6F:0:7AF3:1 -i vlanif 100
      PING FE80::2D6F:0:7AF3:1 : 56  data bytes, press CTRL_C to break
        Reply from FE80::2D6F:0:7AF3:1
        bytes=56 Sequence=1 hop limit=64  time = 7 ms
        Reply from FE80::2D6F:0:7AF3:1
        bytes=56 Sequence=2 hop limit=64  time = 3 ms
        Reply from FE80::2D6F:0:7AF3:1
        bytes=56 Sequence=3 hop limit=64  time = 3 ms
        Reply from FE80::2D6F:0:7AF3:1
        bytes=56 Sequence=4 hop limit=64  time = 3 ms
        Reply from FE80::2D6F:0:7AF3:1
        bytes=56 Sequence=5 hop limit=64  time = 3 ms
    
      --- FE80::2D6F:0:7AF3:1 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 3/3/7 ms
    

    # 从SwitchA上可以Ping通SwitchB的全球单播IPv6地址。

    <SwitchA> ping ipv6 FC00:1::2
      PING FC00:1::2 : 56  data bytes, press CTRL_C to break
        Reply from FC00:1::2
        bytes=56 Sequence=1 hop limit=64  time = 12 ms
        Reply from FC00:1::2
        bytes=56 Sequence=2 hop limit=64  time = 3 ms
        Reply from FC00:1::2
        bytes=56 Sequence=3 hop limit=64  time = 3 ms
        Reply from FC00:1::2
        bytes=56 Sequence=4 hop limit=64  time = 3 ms
        Reply from FC00:1::2
        bytes=56 Sequence=5 hop limit=64  time = 3 ms
    
      --- FC00:1::2 ping statistics ---
        5 packet(s) transmitted
        5 packet(s) received
        0.00% packet loss
        round-trip min/avg/max = 3/4/12 ms
    

     

配置文件

  • SwitchA配置文件
    #
    sysname SwitchA
    #
    vlan batch 100 
    #
    interface Vlanif100
     ipv6 enable
     ipv6 address FC00:1::1/64
    #
    interface 10GE1/0/1
     port link-type trunk
     port trunk allow-pass vlan 100
    #
    return
  • SwitchB配置文件
    #
    sysname SwitchB
    #
    vlan batch 100 
    #
    interface Vlanif100
     ipv6 enable
     ipv6 address FC00:1::2/64
    #
    interface 10GE1/0/1
     port link-type trunk
     port trunk allow-pass vlan 100
    #
    return
阅读剩余
THE END