配置ARP示例

配置ARP示例

组网需求

图1所示,Switch的接口10GE1/0/1通过LAN Switch(即LSW)连接服务器Server1、Server2和Server3,接口10GE1/0/2连接路由器Router,并通过路由器Router连接Server。要求:

  • 10GE1/0/1属于VLAN2,10GE1/0/2属于VLAN3。
  • 为了适应网络的快速变化,保证报文的正确转发,在Switch的接口VLANIF2上配置动态ARP的参数。
  • 为了保证与Server通信的安全性,防止非法ARP报文的侵入,在Switch的接口10GE1/0/2上增加一个静态ARP表项,Router的IP地址为10.2.2.3,对应的MAC地址为00e0-fc01-0000。
图1 配置ARP组网图
配置ARP示例

配置思路

ARP的配置思路如下:

  1. 创建VLAN,并将接口加入到VLAN中。
  2. 配置用户侧VLANIF接口的动态ARP的参数。
  3. 配置静态ARP表项。

操作步骤

  1. 创建VLAN,并将接口加入到VLAN中# 创建VLAN2和VLAN3。
    <HUAWEI> system-view
    [~HUAWEI] sysname Switch
    [*HUAWEI] commit
    [~Switch] vlan batch 2 3
    [*Switch] commit

    # 将接口10GE1/0/1加入VLAN2中,接口10GE1/0/2加入VLAN3中。

    [~Switch] interface 10ge 1/0/1
    [~Switch-10GE1/0/1] port link-type trunk
    [*Switch-10GE1/0/1] port trunk allow-pass vlan 2
    [*Switch-10GE1/0/1] quit
    [*Switch] interface 10ge 1/0/2
    [*Switch-10GE1/0/2] port link-type trunk
    [*Switch-10GE1/0/2] port trunk allow-pass vlan 3
    [*Switch-10GE1/0/2] quit
    [*Switch] commit

     

  2. 配置VLANIF接口的动态ARP的参数# 创建接口VLANIF2。
    [~Switch] interface vlanif 2

    # 配置接口VLANIF2的IP地址。

    [*Switch-Vlanif2] ip address 10.1.1.1 255.255.255.0

    # 配置ARP表项老化时间为60秒。

    [*Switch-Vlanif2] arp timeout 60

    # 配置ARP表项老化探测次数为2次。

    [*Switch-Vlanif2] arp detect times 2
    [*Switch-Vlanif2] quit
    [*Switch] commit

     

  3. 配置静态ARP表项# 创建接口VLANIF3。
    [~Switch] interface vlanif 3

    # 配置接口VLANIF3的IP地址。

    [*Switch-Vlanif3] ip address 10.2.2.2 255.255.255.0
    [*Switch-Vlanif3] quit
    [*Switch] commit

    # 配置一条静态ARP表项:IP地址为10.2.2.3,对应的MAC地址为00e0-fc01-0000,VLAN编号为3,出接口为10GE1/0/2。

    [~Switch] arp static 10.2.2.3 00e0-fc01-0000 vlan 3 interface 10ge 1/0/2
    [*Switch] commit
    [~Switch] quit

     

  4. 验证配置结果# 执行命令display current-configuration,查看表项老化时间、老化探测次数和ARP映射表信息。
    <Switch> display current-configuration | include arp
     arp detect times 2
     arp timeout 60
    arp static 10.2.2.3 00e0-fc01-0000 vlan 3 interface 10GE1/0/2

     

配置文件

Switch的配置文件

#
sysname Switch
#
vlan batch 2 to 3
#
interface Vlanif2
 ip address 10.1.1.1 255.255.255.0
 arp detect times 2
 arp timeout 60
#
interface Vlanif3
 ip address 10.2.2.2 255.255.255.0
#
interface 10GE1/0/1
 port link-type trunk
 port trunk allow-pass vlan 2
#
interface 10GE1/0/2
 port link-type trunk
 port trunk allow-pass vlan 3
#
arp static 10.2.2.3 00e0-fc01-0000 vlan 3 interface 10GE1/0/2
#
return
阅读剩余
THE END