diff --git a/vrrp/frr/rt-1.conf b/vrrp/frr/rt1.conf similarity index 90% rename from vrrp/frr/rt-1.conf rename to vrrp/frr/rt1.conf index 422ffbe..0b59076 100644 --- a/vrrp/frr/rt-1.conf +++ b/vrrp/frr/rt1.conf @@ -1,4 +1,4 @@ -hostname rt-1 +hostname rt1 ! interface eth-br1 vrrp 51 version 2 diff --git a/vrrp/frr/rt-2.conf b/vrrp/frr/rt2.conf similarity index 90% rename from vrrp/frr/rt-2.conf rename to vrrp/frr/rt2.conf index a72f889..3a390c8 100644 --- a/vrrp/frr/rt-2.conf +++ b/vrrp/frr/rt2.conf @@ -1,4 +1,4 @@ -hostname rt-2 +hostname rt2 ! interface eth-br1 vrrp 51 version 2 diff --git a/vrrp/holo/rt-1.conf b/vrrp/holo/rt1.conf similarity index 81% rename from vrrp/holo/rt-1.conf rename to vrrp/holo/rt1.conf index 8dff64c..d2cda10 100644 --- a/vrrp/holo/rt-1.conf +++ b/vrrp/holo/rt1.conf @@ -2,6 +2,7 @@ interfaces interface eth-br1 type iana-if-type:ethernetCsmacd ipv4 + ipv4 address 10.0.1.1 prefix-length 24 ! ipv4 vrrp vrrp-instance 51 priority 10 diff --git a/vrrp/holo/rt-2.conf b/vrrp/holo/rt2.conf similarity index 81% rename from vrrp/holo/rt-2.conf rename to vrrp/holo/rt2.conf index 42e5035..082a56d 100644 --- a/vrrp/holo/rt-2.conf +++ b/vrrp/holo/rt2.conf @@ -2,6 +2,7 @@ interfaces interface eth-br1 type iana-if-type:ethernetCsmacd ipv4 + ipv4 address 10.0.1.2 prefix-length 24 ! ipv4 vrrp vrrp-instance 51 priority 20 diff --git a/vrrp/interfaces/rt-1 b/vrrp/interfaces/rt1 similarity index 100% rename from vrrp/interfaces/rt-1 rename to vrrp/interfaces/rt1 diff --git a/vrrp/interfaces/rt-2 b/vrrp/interfaces/rt2 similarity index 100% rename from vrrp/interfaces/rt-2 rename to vrrp/interfaces/rt2 diff --git a/vrrp/keepalived/.topo.yml.bak b/vrrp/keepalived/.topo.yml.bak new file mode 100644 index 0000000..82e67db --- /dev/null +++ b/vrrp/keepalived/.topo.yml.bak @@ -0,0 +1,13 @@ +name: vrrp-keepalived + + +topology: + nodes: + rt1: + kind: linux + image: ubuntu:24.04 + binds: + - mine.sh:/kd.sh + - rt1.conf:/etc/keepalived/keepalived.conf + exec: + - "/kd.sh" diff --git a/vrrp/keepalived/rt1.conf b/vrrp/keepalived/rt1.conf new file mode 100644 index 0000000..890a598 --- /dev/null +++ b/vrrp/keepalived/rt1.conf @@ -0,0 +1,10 @@ +vrrp_instance VI_1 { + interface eth-br1 + priority 10 + use_vmac + virtual_router_id 51 + advert_int 1 + virtual_ipaddress { + 10.0.1.5 + } +} diff --git a/vrrp/keepalived/rt1.sh b/vrrp/keepalived/rt1.sh new file mode 100755 index 0000000..f533620 --- /dev/null +++ b/vrrp/keepalived/rt1.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if command -v /usr/sbin/keepalived; then + # Setup interfaces + + # loopback + ip addr add 1.1.1.1/32 dev lo + ip link set lo up + + # eth-br1 + ip addr add 10.0.1.1/24 dev eth-br1 + ip link set eth-br1 up + + + service keepalived start +fi diff --git a/vrrp/keepalived/rt2.conf b/vrrp/keepalived/rt2.conf new file mode 100644 index 0000000..fcb3c1b --- /dev/null +++ b/vrrp/keepalived/rt2.conf @@ -0,0 +1,10 @@ +vrrp_instance VI_1 { + interface eth-br1 + priority 20 + use_vmac + virtual_router_id 51 + advert_int 1 + virtual_ipaddress { + 10.0.1.5 + } +} diff --git a/vrrp/keepalived/rt2.sh b/vrrp/keepalived/rt2.sh new file mode 100755 index 0000000..bd93aa3 --- /dev/null +++ b/vrrp/keepalived/rt2.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if command -v /usr/sbin/keepalived; then + # Setup interfaces + + # loopback + ip addr add 2.2.2.2/32 dev lo + ip link set lo up + + # eth-br1 + ip addr add 10.0.1.2/24 dev eth-br1 + ip link set eth-br1 up + + + service keepalived start +fi diff --git a/vrrp/keepalived/topo.yml b/vrrp/keepalived/topo.yml new file mode 100644 index 0000000..82e67db --- /dev/null +++ b/vrrp/keepalived/topo.yml @@ -0,0 +1,13 @@ +name: vrrp-keepalived + + +topology: + nodes: + rt1: + kind: linux + image: ubuntu:24.04 + binds: + - mine.sh:/kd.sh + - rt1.conf:/etc/keepalived/keepalived.conf + exec: + - "/kd.sh" diff --git a/vrrp/rare/rt1.conf b/vrrp/rare/rt1.conf new file mode 100644 index 0000000..136562a --- /dev/null +++ b/vrrp/rare/rt1.conf @@ -0,0 +1,21 @@ +! +vrf definition v1 + rd 1:1 + exit +interface loopback0 + vrf forwarding v1 + ipv4 address 2.2.2.2 255.255.255.255 + no shutdown + no log-link-change + exit +interface ethernet1 + vrf forwarding v1 + ipv4 address 10.0.1.1 255.255.255.0 + ipv4 vrrp address 10.0.1.5 + ipv4 vrrp version 2 + ipv4 vrrp group 51 + ipv4 vrrp priority 10 + no shutdown + no log-link-change + exit +! diff --git a/vrrp/rare/rt2.conf b/vrrp/rare/rt2.conf new file mode 100644 index 0000000..d92b2c7 --- /dev/null +++ b/vrrp/rare/rt2.conf @@ -0,0 +1,21 @@ +! +vrf definition v1 + rd 1:1 + exit +interface loopback0 + vrf forwarding v1 + ipv4 address 2.2.2.2 255.255.255.255 + no shutdown + no log-link-change + exit +interface ethernet1 + vrf forwarding v1 + ipv4 address 10.0.1.2 255.255.255.0 + ipv4 vrrp address 10.0.1.5 + ipv4 vrrp version 2 + ipv4 vrrp group 51 + ipv4 vrrp priority 20 + no shutdown + no log-link-change + exit +! diff --git a/vrrp/topology.yml b/vrrp/topology.yml index 0378759..e41db78 100644 --- a/vrrp/topology.yml +++ b/vrrp/topology.yml @@ -22,7 +22,7 @@ # | 10.0.1.1/24 | 10.0.1.2/24 # +-------------+ +----------+ +------------+ # | | | | | | -# | RT-1 | | Virtual | | RT-2 | +# | RT1 | | Virtual | | RT2 | # | 1.1.1.1 |==============| Router |=============| 2.2.2.2 | # | | | 10.0.1.5| | | # +-------------+ +----------+ +------------+ @@ -34,6 +34,7 @@ name: vrrp topology: + defaults: binds: - ../scripts/start.sh:/start.sh @@ -43,42 +44,86 @@ topology: - "/start.sh" - "/frr-setup.sh" - nodes: + kinds: + rare: + image: ghcr.io/rare-freertr/freertr-containerlab:latest + + nodes: br1: kind: bridge - rt-1: - kind: linux + rt1: # ---- holod image ---- + kind: linux image: ghcr.io/holo-routing/holo:latest - + # ---- frr image ---- + # kind: linux # image: quay.io/frrouting/frr:9.0.2 + # ---- RARE/free-rtr image ---- + # kind: rare + # NOTE: If 'kind:rare' is enabled, look through the links + # to understand how to configure. + + # ---- keepalived image ---- + # kind: linux + # image: ghcr.io/paul-weqe/keepalived:latest + binds: - - interfaces/rt-1:/etc/network/interfaces - - holo/rt-1.conf:/etc/holo.startup - - frr/rt-1.conf:/etc/frr/frr.startup + - interfaces/rt1:/etc/network/interfaces + - holo/rt1.conf:/etc/holo.startup + - frr/rt1.conf:/etc/frr/frr.startup + - rare/rt1.conf:/rtr/run/conf/rtr-sw.txt + - keepalived/rt1.conf:/etc/keepalived/keepalived.conf + - keepalived/rt1.sh:/kd.sh - rt-2: - kind: linux + exec: + - "/kd.sh" + rt2: # ---- holod image ---- + kind: linux image: ghcr.io/holo-routing/holo:latest - + # ---- frr image ---- + # kind: linux # image: quay.io/frrouting/frr:9.0.2 + # ---- RARE/free-rtr image --- + # kind: rare + # NOTE: If 'kind:rare' is enabled, look through the links + # to understand how to configure. + + # ---- keepalived image ---- + # kind: linux + # image: ghcr.io/paul-weqe/keepalived:latest + binds: - - interfaces/rt-2:/etc/network/interfaces - - holo/rt-2.conf:/etc/holo.startup - - frr/rt-2.conf:/etc/frr/frr.startup + - interfaces/rt2:/etc/network/interfaces + - holo/rt2.conf:/etc/holo.startup + - frr/rt2.conf:/etc/frr/frr.startup + - rare/rt2.conf:/root/router.startup + - keepalived/rt2.conf:/etc/keepalived/keepalived.conf + - keepalived/rt2.sh:/kd.sh + + exec: + - "/kd.sh" links: # 10.0.1.0/24 + # Due to clab's RARE/freertr naming conventions, + # interfaces may need to be customized to run RARE. - endpoints: ["host:br-host", "br1:eth-h1"] - - endpoints: ["rt-1:eth-br1", "br1:eth-rt1"] - - endpoints: ["rt-2:eth-br1", "br1:eth-rt2"] + # If rt1 is frr/holo + - endpoints: ["rt1:eth-br1", "br1:eth-rt1"] + # If rt1 is RARE/free-rtr + # - endpoints: ["rt1:eth1", "br1:eth-rt1"] + + # If rt2 is frr/holo + - endpoints: ["rt2:eth-br1", "br1:eth-rt2"] + # If rt2 is RARE/free-rtr + # - endpoints: ["rt2:eth2", "br1:eth-rt2"]