2

L2网关------同子网报文转发

clipboard.png

spine配置

bgp evpn配置

router bgp 7677
 bgp router-id 192.168.59.130
 bgp bestpath as-path multipath-relax
 neighbor fabric peer-group
 neighbor fabric remote-as external
 neighbor 192.168.59.128 peer-group fabric
 neighbor 192.168.59.129 peer-group fabric
 !
 address-family l2vpn evpn
  neighbor fabric activate
 exit-address-family
!

address-family l2vpn evpn:本bgp路由支持地址协议l2vpn evpn。

neighbor fabric activate:表示该地址协议激活,配置该命令后,该设备将会接收和宣告evpn路由。

leaf1和host1配置

接口配置

sudo ip netns add host1
sudo ip link add veth1 type veth peer name eth0 netns host1
sudo ip netns exec host1 ip link set lo up
sudo ip netns exec host1 ip link set eth0 up
sudo ip netns exec host1 ip addr add 2.2.2.2/24 dev eth0
sudo ip link add br10 type bridge
sudo ip link add vxlan10 type vxlan id 10 local 192.168.59.128 dstport 4789 nolearning
sudo ip link set br10 up
sudo ip link set vxlan10 up
sudo ip link set veth1 up  
sudo ip link set veth1 master br10
sudo ip link set vxlan10 master br10    

bgp evpn配置

router bgp 7675
 bgp router-id 192.168.59.128
 bgp bestpath as-path multipath-relax
 neighbor fabric peer-group
 neighbor fabric remote-as external
 neighbor 192.168.59.130 peer-group fabric
 !
 address-family l2vpn evpn
  neighbor fabric activate
  advertise-all-vni
 exit-address-family
!

leaf2和host2配置

接口配置

sudo ip netns add host2
sudo ip link add veth1 type veth peer name eth0 netns host2
sudo ip netns exec host2 ip link set lo up
sudo ip netns exec host2 ip link set eth0 up
sudo ip netns exec host2 ip addr add 2.2.2.3/24 dev eth0 
sudo ip link add br10 type bridge
sudo ip link add vxlan10 type vxlan id 10 local 192.168.59.129 dstport 4789 nolearning
sudo ip link set br10 up
sudo ip link set vxlan10 up
sudo ip link set veth1 up  
sudo ip link set veth1 master br10
sudo ip link set vxlan10 master br10    

bgp evpn配置

router bgp 7676
 bgp router-id 192.168.59.129
 bgp bestpath as-path multipath-relax
 neighbor fabric peer-group
 neighbor fabric remote-as external
 neighbor 192.168.59.130 peer-group fabric
 !
 address-family l2vpn evpn
  neighbor fabric activate
  advertise-all-vni
 exit-address-family
!

查看bgp信息

leaf1

  • 查看邻居信息
ubuntu# show bgp neighbors  
BGP neighbor is 192.168.59.130, remote AS 7677, local AS 7675, external link
Hostname: bgpd
 Member of peer-group fabric for session parameters
  BGP version 4, remote router ID 192.168.59.130, local router ID 192.168.59.128
  BGP state = Established, up for 00:46:26
  Last read 00:00:26, Last write 00:00:26
  Hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    4 Byte AS: advertised and received
    AddPath:
      IPv4 Unicast: RX advertised IPv4 Unicast and received
      L2VPN EVPN: RX advertised L2VPN EVPN and received
    Route refresh: advertised and received(old & new)
    Address Family IPv4 Unicast: advertised and received
    Address Family L2VPN EVPN: advertised and received
    Hostname Capability: advertised (name: bgpd,domain name: n/a) received (name: bgpd,domain name: n/a)
    Graceful Restart Capabilty: advertised and received
      Remote Restart timer is 120 seconds
      Address families by peer:
        none
  Graceful restart information:
    End-of-RIB send: IPv4 Unicast, L2VPN EVPN
    End-of-RIB received: IPv4 Unicast, L2VPN EVPN
  Message statistics:
    Inq depth is 0
    Outq depth is 0
                         Sent       Rcvd
    Opens:                  3          3
    Notifications:          4          0
    Updates:               27         27
    Keepalives:            48         48
    Route Refresh:          0          0
    Capability:             0          0
    Total:                 82         78
  Minimum time between advertisement runs is 0 seconds

 For address family: IPv4 Unicast
  fabric peer-group member
  Update group 4, subgroup 5
  Packet Queue length 0
  Community attribute sent to this neighbor(all)
  0 accepted prefixes

 For address family: L2VPN EVPN
  fabric peer-group member
  Update group 5, subgroup 6
  Packet Queue length 0
  NEXT_HOP is propagated unchanged to this neighbor
  Community attribute sent to this neighbor(all)
  advertise-all-vni
  3 accepted prefixes

  Connections established 2; dropped 1
  Last reset 00:46:28, due to NOTIFICATION sent (Cease/Connection collision resolution)
Local host: 192.168.59.128, Local port: 179
Foreign host: 192.168.59.130, Foreign port: 42668
Nexthop: 192.168.59.128
Nexthop global: fe80::31eb:95a6:e763:13a6
Nexthop local: fe80::31eb:95a6:e763:13a6
BGP connection: shared network
BGP Connect Retry Timer in Seconds: 120
Read thread: on  Write thread: on


ubuntu# 
  • 查看转发表信息
ubuntu# show bgp l2vpn evpn 
BGP table version is 2, local router ID is 192.168.59.128
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: ip 192.168.59.128:4

*> [2]:[0]:[48]:[3a:58:62:d5:eb:53]
                    192.168.59.128                     32768 i
*> [3]:[0]:[32]:[192.168.59.128]
                    192.168.59.128                     32768 i
Route Distinguisher: ip 192.168.59.129:4

*> [2]:[0]:[48]:[c6:cb:34:b1:a1:87]:[128]:[fe80::c3a:daff:fe3b:b737]
                    192.168.59.129                         0 7677 7676 i
*> [2]:[0]:[48]:[de:f6:18:47:27:a6]
                    192.168.59.129                         0 7677 7676 i
*> [3]:[0]:[32]:[192.168.59.129]
                    192.168.59.129                         0 7677 7676 i

Displayed 5 out of 5 total prefixes
ubuntu# 

ouyangxibao
189 声望163 粉丝

不生产代码,只是代码的搬运工