vxlan evpn分布式網(wǎng)關(guān)相同子網(wǎng)和跨子網(wǎng)互通實(shí)驗(yàn)
相同子網(wǎng)互通實(shí)驗(yàn):
配置步驟:
-
組網(wǎng)拓?fù)洌?/p>
- 配置underlay網(wǎng)絡(luò)育拨,保證undlay網(wǎng)絡(luò)互通昆咽;
spine underlay配置
#
interface GE1/0/0
undo portswitch
undo shutdown
ip address 192.168.12.1 255.255.255.0
#
interface GE1/0/1
undo portswitch
undo shutdown
ip address 192.168.13.1 255.255.255.0
#
interface LoopBack0
ip address 1.1.1.1 255.255.255.255
#
ospf 1 router-id 1.1.1.1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 192.168.12.0 0.0.0.255
network 192.168.13.0 0.0.0.255
#
leaf1 underlay網(wǎng)絡(luò)配置
#
interface LoopBack0
ip address 2.2.2.2 255.255.255.255
#
interface GE1/0/0
undo portswitch
undo shutdown
ip address 192.168.12.2 255.255.255.0
#
leaf2 underlay網(wǎng)絡(luò)配置
#
interface LoopBack0
ip address 3.3.3.3 255.255.255.255
#
interface GE1/0/1
undo portswitch
undo shutdown
ip address 192.168.13.3 255.255.255.0
#
- 配置bgp evpn對(duì)等體环肘,用來(lái)通告evpn路由vtep的自動(dòng)發(fā)現(xiàn)和vxlan隧道的建立;
配置前l(fā)eaf必須全局開(kāi)啟evpn-overlay enable ,才能在BGP中配置 l2vpn-family evpn
leaf1 overlay配置
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack0
#
ipv4-family unicast
peer 3.3.3.3 enable
#
l2vpn-family evpn
policy vpn-target
peer 3.3.3.3 enable
peer 3.3.3.3 advertise irb
#
leaf2 overlay 配置
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack0
#
ipv4-family unicast
peer 2.2.2.2 enable
#
l2vpn-family evpn
policy vpn-target
peer 2.2.2.2 enable
peer 2.2.2.2 advertise irb
#
- 驗(yàn)證evpn對(duì)等體已經(jīng)建立:
[~leaf1]display bgp evpn peer
BGP local router ID : 192.168.12.2
Local AS number : 100
Total number of peers : 1
Peers in established state : 1
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
3.3.3.3 4 100 33 35 0 00:23:28 Established 1
- 配置bd和evpn實(shí)例:
[leaf1]
#
bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 0:20
vpn-target 20:20 export-extcommunity
vpn-target 20:20 import-extcommunity
arp broadcast-suppress enable
#
[leaf2]
#
bridge-domain 20
vxlan vni 20
evpn
route-distinguisher 1:20
vpn-target 20:20 export-extcommunity
vpn-target 20:20 import-extcommunity
arp broadcast-suppress enable
#
- 配置vtep地址劲适,用來(lái)建立vxlan隧道:
[leaf1]
#
interface Nve1
source 2.2.2.2
vni 20 head-end peer-list protocol bgp
#
[leaf2]
#
interface Nve1
source 3.3.3.3
vni 20 head-end peer-list protocol bgp
#
- 驗(yàn)證齐板,同子網(wǎng)互通場(chǎng)景下采章,配置完nve接口后景鼠,本端VTEP EVPN實(shí)例會(huì)向?qū)Χ薊VPN實(shí)例通告type3類(lèi)型的路由仲翎,type3主要用來(lái)vtep自動(dòng)發(fā)現(xiàn)和vxlan隧道自動(dòng)建立,因此此時(shí)vxlan隧道已經(jīng)建立成功铛漓,如下:
查看vxlan隧道建立情況:
[~leaf1]display vxlan tunnel
Number of vxlan tunnel : 1
Tunnel ID Source Destination State Type Uptime
-----------------------------------------------------------------------------------
4026531841 2.2.2.2 3.3.3.3 up dynamic 00:20:24
查看type3類(lèi)型路由:
[~leaf1]display bgp evpn vpn-instance 20 routing-table inclusive-route 0:32:3.3.3.3
BGP local router ID : 192.168.12.2
Local AS number : 100
EVPN-Instance 20:
Number of Inclusive Multicast Routes: 1
BGP routing table entry information of 0:32:3.3.3.3:
Route Distinguisher: 1:20----------------------------------------------------evpn實(shí)例路由區(qū)分器
Remote-Cross route
Label information (Received/Applied): 20/NULL -------------------type3攜帶bd下的二層vni
From: 3.3.3.3 (3.3.3.3) ------------------------------------------------------接收路由的evpn對(duì)等體
Route Duration: 0d00h25m38s-------------------------------------------路由學(xué)習(xí)到的時(shí)間
Relay Tunnel Out-Interface: VXLAN
Original nexthop: 3.3.3.3---------------------------------------------------路由下一跳屬性
Qos information : 0x0
Ext-Community: RT <20 : 20>, Tunnel Type <VxLan>----------------vpn-taget
AS-path Nil, origin incomplete, localpref 100, pref-val 0, valid, internal, best, select, pre 255
PMSI: Flags 0, Ingress Replication, Label 0:0:0(20), Tunnel Identifier:3.3.3.3----vni和vtep地址
Route Type: 3 (Inclusive Multicast Route)------路由類(lèi)型為type3
Ethernet Tag ID: 0, Originator IP:3.3.3.3/32----------起源者屬性溯香,路由的起源router-id
Not advertised to any peer yet
- 配置業(yè)務(wù)接口,驗(yàn)證同子網(wǎng)互通
leaf1
interface GE1/0/2
undo shutdown
#
interface GE1/0/2.1 mode l2
encapsulation untag
bridge-domain 20
#
return
leaf2
interface GE1/0/2
undo shutdown
#
interface GE1/0/2.1 mode l2
encapsulation untag
bridge-domain 20
#
- 連通性和結(jié)果驗(yàn)證
PC>ipconfig
Link local IPv6 address...........: fe80::5689:98ff:fe98:6dda
IPv6 address......................: :: / 128
IPv6 gateway......................: ::
IPv4 address......................: 192.168.20.10
Subnet mask.......................: 255.255.255.0
Gateway...........................: 192.168.20.1
Physical address..................: 54-89-98-98-6D-DA
DNS server........................:
PC>ping 192.168.20.20
Ping 192.168.20.20: 32 data bytes, Press Ctrl_C to break
From 192.168.20.20: bytes=32 seq=1 ttl=128 time=16 ms
From 192.168.20.20: bytes=32 seq=2 ttl=128 time=15 ms
From 192.168.20.20: bytes=32 seq=3 ttl=128 time=32 ms
From 192.168.20.20: bytes=32 seq=4 ttl=128 time=15 ms
From 192.168.20.20: bytes=32 seq=5 ttl=128 time=32 ms
--- 192.168.20.20 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 15/22/32 ms
可以看到同網(wǎng)段互通不需要網(wǎng)關(guān)就可以互通
查看mac/ip路由:
~leaf1]display bgp evpn vpn-instance 20 routing-table mac-route
BGP Local router ID is 192.168.12.2
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
EVPN-Instance 20:
Number of Mac Routes: 1
Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop
*>i 0:48:0000-5e00-0001:0:0.0.0.0 3.3.3.3
此時(shí)只有對(duì)端網(wǎng)關(guān)的mac/ip路由浓恶,因?yàn)橥W(wǎng)段通信arp請(qǐng)求在主機(jī)之間逐哈,vtep沒(méi)有配置網(wǎng)關(guān)地址,不能學(xué)習(xí)arp问顷,因此沒(méi)有主機(jī)mac/ip路由。
不同子網(wǎng)互通實(shí)驗(yàn):
配置步驟:
-
組網(wǎng)拓?fù)洌?br> 拓?fù)湓诒3忠陨蠈?shí)驗(yàn)的同時(shí)增加pc3 網(wǎng)段192.168.30.0/24禀梳, vxlan網(wǎng)關(guān)為leaf2設(shè)備上的vbdif30 杜窄。實(shí)驗(yàn)?zāi)康臑槟康臑镻C3192.168.30.30 能夠ping通PC1192.168.20.10:
- 在leaf2增加bd30
#
bridge-domain 30
vxlan vni 30
evpn
route-distinguisher 1:30
vpn-target 30:30 export-extcommunity
vpn-target 10:30 export-extcommunity
vpn-target 30:30 import-extcommunity
#
- 分別在leaf1 和leaf2 配置網(wǎng)關(guān)地址:
<leaf1>
#
interface Vbdif20
ip address 192.168.20.1 255.255.255.0
mac-address 0000-5e00-0001
vxlan anycast-gateway enable
arp collect host enable
#
<leaf2>
#
interface Vbdif30
ip address 192.168.30.1 255.255.255.0
mac-address 0000-5e00-0002
vxlan anycast-gateway enable
arp collect host enable
#
- 分別在leaf1 和 leaf2 配置l3vpn實(shí)例用來(lái)交叉接受不通網(wǎng)段的路由:
<leaf1>
#
ip vpn-instance evpn20
ipv4-family
route-distinguisher 60:20
vpn-target 10:30 import-extcommunity evpn
vxlan vni 60
#
return
<leaf2>
#
ip vpn-instance evpn30
ipv4-family
route-distinguisher 40:30
vpn-target 10:30 import-extcommunity evpn
vpn-target 20:20 import-extcommunity evpn
vxlan vni 50
#
return
leaf1 bd 20 下 export vpn-target 20:20 必須和leaf2 vpn-instance evpn30 的vpn-target 20:20 import-extcommunity evpn對(duì)應(yīng);
leaf2 bd 30 下export vpn-target 10:30 必須和leaf1 vpn-instance evpn20 的vpn-target 10:30 import-extcommunity evpn對(duì)應(yīng)
- 將vpdif接口綁定到對(duì)應(yīng)的l3vpn實(shí)例下面算途,用來(lái)保存各自網(wǎng)關(guān)的mac/ip路由
<leaf1>
#
interface Vbdif20
ip binding vpn-instance evpn20
<leaf2>
#
interface Vbdif30
ip binding vpn-instance evpn30
- 在各自的網(wǎng)關(guān)vpn實(shí)例下分別ping pc1 和 pc3 塞耕,然后查看arp表項(xiàng)和evpn表項(xiàng):
在leaf1 查看arp表象,已經(jīng)有192.168.20.10 5489-9898-6dda
<leaf1>display arp
ARP Entry Types: D - Dynamic, S - Static, I - Interface, O - OpenFlow, RD - Redirect
EXP: Expire-time VLAN:VLAN or Bridge Domain
IP ADDRESS MAC ADDRESS EXP(M) TYPE/VLAN INTERFACE VPN-INSTANCE
----------------------------------------------------------------------------------------
192.168.12.2 3850-1902-0100 I GE1/0/0
192.168.12.1 3850-1901-0100 12 D GE1/0/0
192.168.20.1 0000-5e00-0001 I Vbdif20 evpn20
192.168.20.10 5489-9898-6dda 2 D/BD20 GE1/0/2.1 evpn20
----------------------------------------------------------------------------------------
然后在leaf2 查看嘴瓤,是否已經(jīng)通過(guò)evpn學(xué)習(xí)到了mac/ip路由
<leaf2>display bgp evpn vpn-instance __RD_1_40_30__ routing-table mac-route
BGP Local router ID is 192.168.20.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
EVPN-Instance __RD_1_40_30__:
Number of Mac Routes: 1
Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop
*>i 0:48:5489-9898-6dda:32:192.168.20.10 2.2.2.2--------已經(jīng)學(xué)習(xí)到的路由扫外,
在leaf2 vpn實(shí)例下查看路由表項(xiàng)目:
Proto: Protocol Pre: Preference
Route Flags: R - relay, D - download to fib, T - to vpn-instance, B - black hole route
------------------------------------------------------------------------------
Routing Table : evpn30
Destinations : 5 Routes : 5
Destination/Mask Proto Pre Cost Flags NextHop Interface
192.168.20.10/32 IBGP 255 0 RD 2.2.2.2 VXLAN------已經(jīng)有IBGP主機(jī)路由蔽午,下一跳接口為vxlan
192.168.30.0/24 Direct 0 0 D 192.168.30.1 Vbdif30
192.168.30.1/32 Direct 0 0 D 127.0.0.1 Vbdif30
192.168.30.255/32 Direct 0 0 D 127.0.0.1 Vbdif30
255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0
查看mac/ip路由詳細(xì)信息:
<leaf2>display bgp evpn vpn-instance __RD_1_40_30__ routing-table mac-route 0:48:5489-9898-6dda:32:192.168.20.10
BGP local router ID : 192.168.20.1
Local AS number : 100
EVPN-Instance __RD_1_40_30__:
Number of Mac Routes: 1
BGP routing table entry information of 0:48:5489-9898-6dda:32:192.168.20.10:----路由條目信息
Route Distinguisher: 0:20----evpn實(shí)例的RD
Remote-Cross route
Label information (Received/Applied): 20 60/NULL-----二層vni和三層vni
From: 2.2.2.2 (192.168.12.2) ---------------------------------路由來(lái)自于那個(gè)對(duì)等體
Route Duration: 0d00h42m30s------------------------------路由已經(jīng)學(xué)習(xí)到的時(shí)間
Relay Tunnel Out-Interface: VXLAN
Original nexthop: 2.2.2.2--------------------------------------路由下一跳屬性
Qos information : 0x0
Ext-Community: RT <20 : 20>, Tunnel Type <VxLan>, Router's MAC <707b-e8af-4e9f>------------------擴(kuò)展團(tuán)體屬性為vpn-target 和對(duì)端nve接口的mac地址
AS-path Nil, origin incomplete, localpref 100, pref-val 0, valid, internal, best, select, pre 255
Route Type: 2 (MAC Advertisement Route) --------路由類(lèi)型為type2
Ethernet Tag ID: 0, MAC Address/Len: 5489-9898-6dda/48, IP Address/Len: 192.168.20.10/32, ESI:0000.0000.0000.0000.0000 ----type2路由類(lèi)型攜帶的mac/ip
Not advertised to any peer yet
- 在leaf1 清除arp表項(xiàng)袱瓮,查看leaf2 是否還有路由:
<leaf1>reset arp all
<leaf1>display arp
ARP Entry Types: D - Dynamic, S - Static, I - Interface, O - OpenFlow, RD - Redirect
EXP: Expire-time VLAN:VLAN or Bridge Domain
IP ADDRESS MAC ADDRESS EXP(M) TYPE/VLAN INTERFACE VPN-INSTANCE
----------------------------------------------------------------------------------------
192.168.12.2 3850-1902-0100 I GE1/0/0
192.168.12.1 3850-1901-0100 20 D GE1/0/0
192.168.20.1 0000-5e00-0001 I Vbdif20 evpn20
----------------------------------------------------------------------------------------
Total:3 Dynamic:1 Static:0 Interface:2 OpenFlow:0
Redirect:0
<leaf1>
<leaf2>display bgp evpn vpn-instance __RD_1_40_30__ routing-table mac-route
<leaf2>
可以看到已經(jīng)沒(méi)有mac/ip路由,說(shuō)明evpn路由表象來(lái)自于arp表項(xiàng)锐峭。
在剛開(kāi)始的同子網(wǎng)實(shí)驗(yàn)中停忿,因?yàn)闆](méi)有配置網(wǎng)關(guān)驾讲,因此vtep之間沒(méi)有通告主機(jī)的mac/ip路由,現(xiàn)在已經(jīng)有了網(wǎng)關(guān)席赂,看leaf1和leaf2是否已經(jīng)相互通告了各自主機(jī)PC1和PC2的mac/ip路由
<leaf2>display bgp evpn vpn-instance 20 routing-table mac-route
BGP Local router ID is 192.168.20.1
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
EVPN-Instance 20:
Number of Mac Routes: 3
Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop
*> 0:48:0000-5e00-0001:0:0.0.0.0 0.0.0.0
* i 2.2.2.2
*>i 0:48:5489-9898-6dda:32:192.168.20.10 2.2.2.2
<leaf1>display bgp evpn vpn-instance 20 routing-table mac-route
BGP Local router ID is 192.168.12.2
Status codes: * - valid, > - best, d - damped, x - best external, a - add path,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
EVPN-Instance 20:
Number of Mac Routes: 4
Network(EthTagId/MacAddrLen/MacAddr/IpAddrLen/IpAddr) NextHop
*> 0:48:0000-5e00-0001:0:0.0.0.0 0.0.0.0
* i 3.3.3.3
*>i 0:48:0000-5e00-0002:0:0.0.0.0 3.3.3.3
*> 0:48:5489-9898-6dda:32:192.168.20.10 0.0.0.0
可以看到leaf2已經(jīng)學(xué)習(xí)到了PC1的mac/ip路由信息
原理總結(jié)
待續(xù)吮铭。。颅停。谓晌。。