华三手工VXLAN实现二层互通-助力2台路由器建立BGP邻居

一 网络拓扑

如上如:

2台Leaf设备建立手工VXLAN隧道,实现二层网络打通;

然后2台R路由器通过IBGP(AS100)建立BGP邻居学习路由;

二 设备配置

2.1 Leaf01设备配置

1.Leaf01配置Underlay

#

sysname Leaf01

#

 ip unreachables enable

 ip ttl-expires enable

#

 lldp global enable

#

ospf 1 router-id 6.6.6.1  //发布互联地址和loopback地址

 area 0.0.0.0

  network 1.1.1.0 0.0.0.3

  network 6.6.6.1 0.0.0.0

#

interface LoopBack0

 description router-id&vtep

 ip address 6.6.6.1 255.255.255.255

#

interface GigabitEthernet1/0/2

 port link-mode route

 description TO-Leaf02

 combo enable fiber

 ip address 1.1.1.1 255.255.255.252

#

2.Leaf01配置Overlay静态VXLAN

#

 l2vpn enable  //全局使能 evpn功能

#

interface Tunnel1 mode vxlan //配置tunnel接口,隧道原和目的为loopback地址

 source 6.6.6.1

 destination 6.6.6.2

#

vsi vpn1  //配置vpn实例,绑定vxlan和vxlan隧道接口

 vxlan 10

  tunnel 1

#

vlan 10  //vlan配置

 description YW

#

interface GigabitEthernet1/0/1  //连接PC接口绑定vlan和对应的vpn

 port link-mode bridge

 description TO-R1

 port access vlan 10

 #

 service-instance 1000

  encapsulation s-vid 10

  xconnect vsi vpn1

#

2.2 Leaf02设备配置

#

1.Leaf02配置Underlay

sysname Leaf02

#

 ip unreachables enable

 ip ttl-expires enable

#

 lldp global enable

#

ospf 1 router-id 6.6.6.2  //发布互联地址和loopback地址

 area 0.0.0.0

  network 1.1.1.0 0.0.0.3

  network 6.6.6.2 0.0.0.0

#

interface LoopBack0

 description router-id&vtep

 ip address 6.6.6.2 255.255.255.255

#

interface GigabitEthernet1/0/1

 port link-mode route

 description TO-Leaf01

 combo enable fiber

 ip address 1.1.1.2 255.255.255.252

#

2.Leaf02配置Overlay静态VXLAN

#

 l2vpn enable  //全局使能 evpn功能

#

interface Tunnel1 mode vxlan   //配置tunnel接口,隧道原和目的为loopback地址

 source 6.6.6.2

 destination 6.6.6.1

#

vsi vpn1  //配置vpn实例,绑定vxlan和vxlan隧道接口

 vxlan 10

   tunnel 1

#

vlan 10  //vlan配置

 description YW

#

interface GigabitEthernet1/0/2 //发布互联地址和loopback地址

 port link-mode bridge

 port access vlan 10

 #

 service-instance 1000

  encapsulation s-vid 10

  xconnect vsi vpn1

#

2.3 R1设备

sysname R1

#

 ip unreachables enable

 ip ttl-expires enable

#

 lldp global enable

#

interface LoopBack0 //模拟业务地址

 description R1-YW

 ip address 192.168.1.1 255.255.255.255

#

interface GigabitEthernet0/0

 port link-mode route

 description TO-Leaf01

 combo enable copper

 ip address 2.2.2.1 255.255.255.252

#

bgp 100  //使用互联地址建立bgp邻居并发布业务地址

 peer 2.2.2.2 as-number 100

 #

 address-family ipv4 unicast

  network 192.168.1.1 255.255.255.255

  peer 2.2.2.2 enable

#

2.4 R2设备

sysname R2

#

 ip unreachables enable

 ip ttl-expires enable

#

 lldp global enable

#

interface LoopBack0 //模拟业务地址

 description R2-YW

 ip address 192.168.2.1 255.255.255.255

#

interface GigabitEthernet0/0

 port link-mode route

 description TO-Leaf01

 combo enable copper

 ip address 2.2.2.2 255.255.255.252

#

bgp 100  //使用互联地址建立bgp邻居并发布业务地址

 peer 2.2.2.1 as-number 100

 #

 address-family ipv4 unicast

  network 192.168.1.1 255.255.255.255

  peer 2.2.2.1 enable

#

三 设备状态查看

3.1 Leaf01设备查看

<Leaf01>display interface tunnel //vxlan隧道接口查看

Tunnel1

Current state: UP

Line protocol state: UP

Description: Tunnel1 Interface

Bandwidth: 64 kbps

Maximum transmission unit: 1464

Internet protocol processing: Disabled

Last clearing of counters: Never

Tunnel source 6.6.6.1, destination 6.6.6.2

Tunnel protocol/transport UDP_VXLAN/IP

Last 300 seconds input rate: 166 bytes/sec, 1328 bits/sec, 1 packets/sec

Last 300 seconds output rate: 167 bytes/sec, 1336 bits/sec, 1 packets/sec

Input: 1059 packets, 102589 bytes, 0 drops

Output: 1066 packets, 103314 bytes, 0 drops

<Leaf01>display l2vpn vsi

Total number of VSIs: 1, 1 up, 0 down, 0 admin down

VSI Name                        VSI Index       MTU    State    

vpn1                            0               1500   Up       

<Leaf01>display l2vpn vsi verbose //svi接口状态查看

VSI Name: vpn1

  VSI Index               : 0

  VSI State               : Up

  MTU                     : 1500

  Bandwidth               : -

  Broadcast Restrain      : -

  Multicast Restrain      : -

  Unknown Unicast Restrain: -

  MAC Learning            : Enabled

  MAC Table Limit         : -

  MAC Learning rate       : -

  Drop Unknown            : -

  Flooding                : Enabled

  VXLAN ID                : 10

  Tunnels:

    Tunnel Name          Link ID    State    Type        Flood proxy

    Tunnel1              0x5000001  UP       Manual      Disabled

  ACs:

    AC                                 Link ID    State       Type   

    GE1/0/1 srv1000                    0          Up          Manual 

<Leaf01>display l2vpn mac-address  //堆叠设备mac地址查看

* - The output interface is issued to another VSI

MAC Address    State     VSI Name                        Link ID/Name   Aging  

0a0d-97c3-0305 Dynamic   vpn1                            GE1/0/1        Aging  

0a0d-9b50-0405 Dynamic   vpn1                            Tunnel1        Aging  

--- 2 mac address(es) found  ---

<Leaf01>dis vxlan tunnel  //查看vxlan隧道

Total number of VXLANs: 1

Total number of VXLAN tunnels: 1

VXLAN ID: 10, VSI name: vpn1, Total tunnels: 1 (1 up, 0 down, 0 defect, 0 blocked)

Tunnel name Source          Destination     State   Type   Flood proxy Out VNI

Tun1        6.6.6.1         6.6.6.2         UP      Manual Disabled    -

3.2 Leaf02设备查看

<Leaf02>display interface tunnel  //vxlan隧道接口查看

Tunnel1

Current state: UP

Line protocol state: UP

Description: Tunnel1 Interface

Bandwidth: 64 kbps

Maximum transmission unit: 1464

Internet protocol processing: Disabled

Last clearing of counters: Never

Tunnel source 6.6.6.2, destination 6.6.6.1

Tunnel protocol/transport UDP_VXLAN/IP

Last 300 seconds input rate: 147 bytes/sec, 1176 bits/sec, 1 packets/sec

Last 300 seconds output rate: 145 bytes/sec, 1160 bits/sec, 1 packets/sec

Input: 1067 packets, 103380 bytes, 0 drops

Output: 1060 packets, 102674 bytes, 0 drops

<Leaf02>display l2vpn vsi  //svi接口状态查看

Total number of VSIs: 1, 1 up, 0 down, 0 admin down

VSI Name                        VSI Index       MTU    State    

vpn1                            0               1500   Up       

<Leaf02>display l2vpn vsi verbose   //堆叠设备mac地址查看

VSI Name: vpn1

  VSI Index               : 0

  VSI State               : Up

  MTU                     : 1500

  Bandwidth               : -

  Broadcast Restrain      : -

  Multicast Restrain      : -

  Unknown Unicast Restrain: -

  MAC Learning            : Enabled

  MAC Table Limit         : -

  MAC Learning rate       : -

  Drop Unknown            : -

  Flooding                : Enabled

  VXLAN ID                : 10

  Tunnels:

    Tunnel Name          Link ID    State    Type        Flood proxy

    Tunnel1              0x5000001  UP       Manual      Disabled

  ACs:

    AC                                 Link ID    State       Type   

    GE1/0/2 srv1000                    0          Up          Manual 

<Leaf02>display l2vpn mac-address  //堆叠设备mac地址查看

* - The output interface is issued to another VSI

MAC Address    State     VSI Name                        Link ID/Name   Aging  

0a0d-97c3-0305 Dynamic   vpn1                            Tunnel1        Aging  

0a0d-9b50-0405 Dynamic   vpn1                            GE1/0/2        Aging   

--- 2 mac address(es) found  ---

<Leaf02>dis vxlan tunnel  //查看vxlan隧道

Total number of VXLANs: 1

Total number of VXLAN tunnels: 1

VXLAN ID: 10, VSI name: vpn1, Total tunnels: 1 (1 up, 0 down, 0 defect, 0 blocked)

Tunnel name Source          Destination     State   Type   Flood proxy Out VNI

Tun1        6.6.6.2         6.6.6.1         UP      Manual Disabled    -

3.3 R1设备查看

<R1>display ip rou

Destinations : 12       Routes : 12

Destination/Mask   Proto   Pre Cost        NextHop         Interface

0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.0/30         Direct  0   0           2.2.2.1         GE0/0

2.2.2.1/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.3/32         Direct  0   0           2.2.2.1         GE0/0

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

192.168.1.1/32     Direct  0   0           127.0.0.1       InLoop0

192.168.2.1/32     BGP     255 0           2.2.2.2         GE0/0

224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0

224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

<R1>dis bgp peer ipv4

 BGP local router ID: 192.168.1.1

 Local AS number: 100

 Total number of peers: 1                 Peers in established state: 1

  * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  2.2.2.2                100       15       18    0       1 00:12:13 Established

<R1>dis bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 192.168.1.1

 Status codes: * - valid, > - best, d - dampened, h - history,

               s - suppressed, S - stale, i - internal, e - external

               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >  192.168.1.1/32     127.0.0.1       0                     32768   i

* >i 192.168.2.1/32     2.2.2.2         0          100        0       i

<R1>

3.4 R2设备查看

<R2>display ip rou

Destinations : 12       Routes : 12

Destination/Mask   Proto   Pre Cost        NextHop         Interface

0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.0/30         Direct  0   0           2.2.2.2         GE0/0

2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.3/32         Direct  0   0           2.2.2.2         GE0/0

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

192.168.1.1/32     BGP     255 0           2.2.2.1         GE0/0

192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0

224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0

224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

<R2>dis bgp peer ipv4

 BGP local router ID: 192.168.2.1

 Local AS number: 100

 Total number of peers: 1                 Peers in established state: 1

  * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  2.2.2.1                100       18       16    0       1 00:11:16 Established

<R2>dis bgp routing-table ipv4

 Total number of routes: 2

 BGP local router ID is 192.168.2.1

 Status codes: * - valid, > - best, d - dampened, h - history,

               s - suppressed, S - stale, i - internal, e - external

               Origin: i - IGP, e - EGP, ? - incomplete

     Network            NextHop         MED        LocPrf     PrefVal Path/Ogn

* >i 192.168.1.1/32     2.2.2.1         0          100        0       i

* >  192.168.2.1/32     127.0.0.1       0                     32768   i

<R2>

四 业务测试

4.1 R1业务测试

<R1>dis ip ro

Destinations : 12       Routes : 12

Destination/Mask   Proto   Pre Cost        NextHop         Interface

0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.0/30         Direct  0   0           2.2.2.1         GE0/0

2.2.2.1/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.3/32         Direct  0   0           2.2.2.1         GE0/0

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

192.168.1.1/32     Direct  0   0           127.0.0.1       InLoop0

192.168.2.1/32     BGP     255 0           2.2.2.2         GE0/0

224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0

224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

<R1>

<R1>dis bgp peer ipv4

 BGP local router ID: 192.168.1.1

 Local AS number: 100

 Total number of peers: 1                 Peers in established state: 1

  * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  2.2.2.2                100       96      115    0       1 01:35:42 Established

<R1>

<R1>ping -a 192.168.1.1 192.168.2.1

Ping 192.168.2.1 (192.168.2.1) from 192.168.1.1: 56 data bytes, press CTRL+C to break

56 bytes from 192.168.2.1: icmp_seq=0 ttl=255 time=1.096 ms

56 bytes from 192.168.2.1: icmp_seq=1 ttl=255 time=1.087 ms

56 bytes from 192.168.2.1: icmp_seq=2 ttl=255 time=1.304 ms

56 bytes from 192.168.2.1: icmp_seq=3 ttl=255 time=1.819 ms

56 bytes from 192.168.2.1: icmp_seq=4 ttl=255 time=1.105 ms

--- Ping statistics for 192.168.2.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.087/1.282/1.819/0.280 ms

<R1>%Jun  2 13:14:52:067 2026 R1 PING/6/PING_STATISTICS: Ping statistics for 192.168.2.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.087/1.282/1.819/0.280 ms.

<R1>tracert -a 192.168.1.1 192.168.2.1

traceroute to 192.168.2.1 (192.168.2.1) from 192.168.1.1, 30 hops at most, 40 bytes each packet, press CTRL+C to break

 1  2.2.2.2 (2.2.2.2)  2.072 ms  0.892 ms  4.878 ms

<R1>

4.2 R2业务测试

<R2>dis ip ro

Destinations : 12       Routes : 12

Destination/Mask   Proto   Pre Cost        NextHop         Interface

0.0.0.0/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.0/30         Direct  0   0           2.2.2.2         GE0/0

2.2.2.2/32         Direct  0   0           127.0.0.1       InLoop0

2.2.2.3/32         Direct  0   0           2.2.2.2         GE0/0

127.0.0.0/8        Direct  0   0           127.0.0.1       InLoop0

127.0.0.1/32       Direct  0   0           127.0.0.1       InLoop0

127.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

192.168.1.1/32     BGP     255 0           2.2.2.1         GE0/0

192.168.2.1/32     Direct  0   0           127.0.0.1       InLoop0

224.0.0.0/4        Direct  0   0           0.0.0.0         NULL0

224.0.0.0/24       Direct  0   0           0.0.0.0         NULL0

255.255.255.255/32 Direct  0   0           127.0.0.1       InLoop0

<R2>

<R2>dis bgp peer ipv4

 BGP local router ID: 192.168.2.1

 Local AS number: 100

 Total number of peers: 1                 Peers in established state: 1

  * - Dynamically created peer

  Peer                    AS  MsgRcvd  MsgSent OutQ PrefRcv Up/Down  State

  2.2.2.1                100      115       97    0       1 01:26:32 Established

<R2>

<R2>

<R2>ping -a 192.168.2.1 192.168.1.1

Ping 192.168.1.1 (192.168.1.1) from 192.168.2.1: 56 data bytes, press CTRL+C to break

56 bytes from 192.168.1.1: icmp_seq=0 ttl=255 time=2.000 ms

56 bytes from 192.168.1.1: icmp_seq=1 ttl=255 time=1.000 ms

56 bytes from 192.168.1.1: icmp_seq=2 ttl=255 time=3.000 ms

56 bytes from 192.168.1.1: icmp_seq=3 ttl=255 time=2.000 ms

56 bytes from 192.168.1.1: icmp_seq=4 ttl=255 time=1.000 ms

--- Ping statistics for 192.168.1.1 ---

5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss

round-trip min/avg/max/std-dev = 1.000/1.800/3.000/0.748 ms

<R2>%Jun  2 13:06:17:907 2026 R2 PING/6/PING_STATISTICS: Ping statistics for 192.168.1.1: 5 packet(s) transmitted, 5 packet(s) received, 0.0% packet loss, round-trip min/avg/max/std-dev = 1.000/1.800/3.000/0.748 ms.

<R2>

<R2>tracert -a 192.168.2.1 192.168.1.1

traceroute to 192.168.1.1 (192.168.1.1) from 192.168.2.1, 30 hops at most, 40 bytes each packet, press CTRL+C to break

 1  2.2.2.1 (2.2.2.1)  2.000 ms  1.000 ms  1.000 ms

<R2>

五 抓包查看

5.1 Leaf01连接Leaf02接口抓包-UDP4789为VXLAN报文

5.2 两端R设备通过中间VXLAN二层互通建立BGP邻居学习路由

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值