配置ND任意代理示例
配置ND任意代理功能,实现处在相同的网段却不在同一物理网络并且连接VM的网关设备具有相同的网关地址的设备间的互通。
组网需求
针对服务器划分VM的情况,为了使得VM能够在多个服务器或多个网关设备间灵活部署与迁移,常用的方法是将多个网关设备的二层连通。但是,这种方式会导致网络中二层域变大,并存在广播风暴的风险。为了解决这一问题,常用的方式是在VM的网关设备上开启ND任意代理,将网关设备端口的MAC地址发送给请求的VM,将VM到其他VM的通讯都转变为路由转发。
配置思路
采用如下的思路配置ND任意代理功能:
创建VLAN,使得需要互通的VM处于相同的VLAN。
配置端口属性,关联端口和VLAN。
配置设备接口的IPv6地址。
在设备的VLANIF接口上配置ND任意代理功能,使得VM发送一个NS请求(请求目的VM的MAC地址),使能ND任意代理功能的设备收到这样的请求后,会使用自己的MAC地址作为该NS请求的回应,以此进行数据转发。
配置发布IPv6 NDP Vlink直连路由。
操作步骤
- 创建VLAN
在DeviceA和DeviceB上请配置相同的VLAN ID。
# 配置DeviceA。<HUAWEI> system-view
[~HUAWEI] sysname DeviceA
[*HUAWEI] commit
[~DeviceA] vlan 10
[*DeviceA-vlan10] commit
[~DeviceA-vlan10] quit
# 配置DeviceB。<HUAWEI> system-view
[~HUAWEI] sysname DeviceB
[*HUAWEI] commit
[~DeviceB] vlan 10
[*DeviceB-vlan10] commit
[~DeviceB-vlan10] quit
- 配置端口属性,关联端口和VLAN
# 配置DeviceA。
[~DeviceA] interface gigabitethernet 0/1/1
[~DeviceA-GigabitEthernet0/1/1] portswitch
[*DeviceA-GigabitEthernet0/1/1] port link-type access
[*DeviceA-GigabitEthernet0/1/1] quit
[*DeviceA] vlan 10
[*DeviceA-vlan10] port gigabitethernet 0/1/1
[*DeviceA-vlan10] commit
[~DeviceA-vlan10] quit
# 配置DeviceB。[~DeviceB] interface gigabitethernet 0/1/1
[~DeviceB-GigabitEthernet0/1/1] portswitch
[*DeviceB-GigabitEthernet0/1/1] port link-type access
[*DeviceB-GigabitEthernet0/1/1] quit
[*DeviceB] vlan 10
[*DeviceB-vlan10] port gigabitethernet 0/1/1
[*DeviceB-vlan10] commit
[~DeviceB-vlan10] quit
- 配置设备接口的IPv6地址
在DeviceA和DeviceB上请配置相同的VLANIF接口地址。
# 配置DeviceA。[~DeviceA] interface vlanif 10
[*DeviceA-Vlanif10] ipv6 enable
[*DeviceA-Vlanif10] ipv6 address 2001:db8:300:400::3 64
# 配置DeviceB。[~DeviceB] interface vlanif 10
[*DeviceB-Vlanif10] ipv6 enable
[*DeviceB-Vlanif10] ipv6 address 2001:db8:300:400::3 64
- 使能ND任意代理功能,并发布IPv6 NDP Vlink直连路由
# 配置DeviceA。
[*DeviceA-Vlanif10] ipv6 nd proxy anyway enable
[*DeviceA-Vlanif10] quit
[*DeviceA] ipv6 nd vlink-direct-route advertise
[*DeviceA] commit
# 配置DeviceB。[*DeviceB-Vlanif10] ipv6 nd proxy anyway enable
[*DeviceB-Vlanif10] quit
[*DeviceB] ipv6 nd vlink-direct-route advertise
[*DeviceB] commit
- 配置VM
# 配置VM1的IPv6地址为2001:db8:300:400::1/64。
# 配置VM2的IPv6地址为2001:db8:300:400::2/64。
- 验证配置结果
配置完成后,VM1和VM2之间可以互相Ping通。
配置文件
DeviceA的配置文件
# sysname DeviceA # vlan batch 10 # ipv6 nd vlink-direct-route advertise # interface Vlanif10 ipv6 enable ipv6 address 2001:DB8:300:400::3/64 ipv6 nd proxy anyway enable # interface GigabitEthernet0/1/1 portswitch undo shutdown port link-type access port default vlan 10 # return
DeviceB的配置文件
# sysname DeviceB # vlan batch 10 # ipv6 nd vlink-direct-route advertise # interface Vlanif10 ipv6 enable ipv6 address 2001:DB8:300:400::3/64 ipv6 nd proxy anyway enable # interface GigabitEthernet0/1/1 portswitch undo shutdown port link-type access port default vlan 10 # return