-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makefile: create bgp HA environment with clab
Signed-off-by: 张祖建 <[email protected]>
- Loading branch information
1 parent
7bd415c
commit b6f4464
Showing
3 changed files
with
141 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: bgp | ||
topology: | ||
kinds: | ||
linux: | ||
image: kubeovn/kube-ovn:{{ kube_ovn_version }} | ||
cmd: bash | ||
|
||
nodes: | ||
switch: | ||
kind: linux | ||
exec: | ||
- ip link add br0 type bridge | ||
- ip link set net1 master br0 | ||
- ip link set net2 master br0 | ||
- ip link set net3 master br0 | ||
- ip link set net4 master br0 | ||
- ip link set net5 master br0 | ||
- ip link set net6 master br0 | ||
- ip link set net7 master br0 | ||
- ip link set br0 up | ||
router-1: | ||
kind: linux | ||
image: frrouting/frr:v8.4.1 | ||
labels: | ||
app: frr | ||
exec: | ||
- ip link delete eth0 | ||
- ip address add 10.0.1.1/24 dev net1 | ||
- ip address add 10.0.2.1/24 dev net2 | ||
- touch /etc/frr/vtysh.conf | ||
- sed -i -e 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons | ||
- /usr/lib/frr/frrinit.sh start | ||
- >- | ||
vtysh -c 'conf t' | ||
-c 'frr defaults datacenter' | ||
-c 'router bgp 65001' | ||
-c ' bgp router-id 10.0.1.1' | ||
-c ' no bgp ebgp-requires-policy' | ||
-c ' neighbor SERVERS peer-group' | ||
-c ' neighbor SERVERS remote-as external' | ||
-c ' neighbor 10.0.1.101 peer-group SERVERS' | ||
-c ' neighbor 10.0.1.102 peer-group SERVERS' | ||
-c ' address-family ipv4 unicast' | ||
-c ' redistribute connected' | ||
-c ' exit-address-family' | ||
-c '!' | ||
router-2: | ||
kind: linux | ||
image: frrouting/frr:v8.4.1 | ||
labels: | ||
app: frr | ||
exec: | ||
- ip link delete eth0 | ||
- ip address add 10.0.1.2/24 dev net1 | ||
- ip address add 10.0.2.2/24 dev net2 | ||
- touch /etc/frr/vtysh.conf | ||
- sed -i -e 's/bgpd=no/bgpd=yes/g' /etc/frr/daemons | ||
- /usr/lib/frr/frrinit.sh start | ||
- >- | ||
vtysh -c 'conf t' | ||
-c 'frr defaults datacenter' | ||
-c 'router bgp 65001' | ||
-c ' bgp router-id 10.0.1.2' | ||
-c ' no bgp ebgp-requires-policy' | ||
-c ' neighbor SERVERS peer-group' | ||
-c ' neighbor SERVERS remote-as external' | ||
-c ' neighbor 10.0.1.101 peer-group SERVERS' | ||
-c ' neighbor 10.0.1.102 peer-group SERVERS' | ||
-c ' address-family ipv4 unicast' | ||
-c ' redistribute connected' | ||
-c ' exit-address-family' | ||
-c '!' | ||
k8s-master: | ||
kind: linux | ||
network-mode: container:kube-ovn-control-plane | ||
exec: | ||
- ip address add 10.0.1.101/24 dev net1 | ||
- ip route add 10.0.0.0/16 via 10.0.1.1 | ||
k8s-worker: | ||
kind: linux | ||
network-mode: container:kube-ovn-worker | ||
exec: | ||
- ip address add 10.0.1.102/24 dev net1 | ||
- ip route add 10.0.0.0/16 via 10.0.1.1 | ||
ext: | ||
kind: linux | ||
exec: | ||
- ip address add 10.0.2.101/24 dev net1 | ||
- ip route replace default nexthop via 10.0.2.1 weight 1 nexthop via 10.0.2.2 weight 1 | ||
|
||
links: | ||
- endpoints: ["switch:net1", "router-1:net1"] | ||
- endpoints: ["switch:net2", "router-1:net2"] | ||
- endpoints: ["switch:net3", "router-2:net1"] | ||
- endpoints: ["switch:net4", "router-2:net2"] | ||
- endpoints: ["switch:net5", "k8s-master:net1"] | ||
- endpoints: ["switch:net6", "k8s-worker:net1"] | ||
- endpoints: ["switch:net7", "ext:net1"] |