User Tools

Site Tools


documentation:examples:simple_vrrp_lab

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
documentation:examples:simple_vrrp_lab [2026/02/27 01:43] – [Forwarding and ARP entry] olivierdocumentation:examples:simple_vrrp_lab [2026/02/27 09:55] (current) – [Starting the lab] olivier
Line 13: Line 13:
  
 <code> <code>
-# ./BSDRP-lab-bhyve.sh -i /usr/obj/BSDRP.amd64/BSDRP-1.61-full-amd64-vga.img -n 4 -l 2 +# ./BSDRP-lab-bhyve.sh -i /usr/obj/BSDRP.amd64/BSDRP-2.1-full-amd64.img -n 4 -l 2
-vmm module not loaded. Loading it... +
-nmdm module not loaded. Loading it... +
-if_tap module not loaded. Loading it... +
-BSD Router Project (http://bsdrp.net) - bhyve full-meshed lab script+
 Setting-up a virtual lab with 4 VM(s): Setting-up a virtual lab with 4 VM(s):
-- Working directory: /tmp/BSDRP +- Working directory: /home/olivier/BSDRP-VMs 
-- Each VM have core(s) and 256M RAM+- Each VM has a total of 1 (1 cores and 1 threads) and 1G RAM 
 +- Emulated NIC: virtio-net 
 +- Boot mode: UEFI
 - Switch mode: bridge + tap - Switch mode: bridge + tap
 - 2 LAN(s) between all VM - 2 LAN(s) between all VM
 - Full mesh Ethernet links between each VM - Full mesh Ethernet links between each VM
-VM 1 have the following NIC: +VM 1 has the following NIC: 
-- vtnet0 connected to VM 2. +- vtnet0 connected to VM 2 
-- vtnet1 connected to VM 3. +- vtnet1 connected to VM 3 
-- vtnet2 connected to VM 4.+- vtnet2 connected to VM 4
 - vtnet3 connected to LAN number 1 - vtnet3 connected to LAN number 1
 - vtnet4 connected to LAN number 2 - vtnet4 connected to LAN number 2
-VM 2 have the following NIC: +VM 2 has the following NIC: 
-- vtnet0 connected to VM 1. +- vtnet0 connected to VM 1 
-- vtnet1 connected to VM 3. +- vtnet1 connected to VM 3 
-- vtnet2 connected to VM 4.+- vtnet2 connected to VM 4
 - vtnet3 connected to LAN number 1 - vtnet3 connected to LAN number 1
 - vtnet4 connected to LAN number 2 - vtnet4 connected to LAN number 2
-VM 3 have the following NIC: +VM 3 has the following NIC: 
-- vtnet0 connected to VM 1. +- vtnet0 connected to VM 1 
-- vtnet1 connected to VM 2. +- vtnet1 connected to VM 2 
-- vtnet2 connected to VM 4.+- vtnet2 connected to VM 4
 - vtnet3 connected to LAN number 1 - vtnet3 connected to LAN number 1
 - vtnet4 connected to LAN number 2 - vtnet4 connected to LAN number 2
-VM 4 have the following NIC: +VM 4 has the following NIC: 
-- vtnet0 connected to VM 1. +- vtnet0 connected to VM 1 
-- vtnet1 connected to VM 2. +- vtnet1 connected to VM 2 
-- vtnet2 connected to VM 3.+- vtnet2 connected to VM 3
 - vtnet3 connected to LAN number 1 - vtnet3 connected to LAN number 1
 - vtnet4 connected to LAN number 2 - vtnet4 connected to LAN number 2
-For connecting to VM'serial console, you can use: +To connect VM'serial console, you can use: 
-- VM 1 : cu -l /dev/nmdm1B +- VM 1 : sudo cu -l /dev/nmdm-BSDRP.1B 
-- VM 2 : cu -l /dev/nmdm2B +- VM 2 : sudo cu -l /dev/nmdm-BSDRP.2B 
-- VM : cu -l /dev/nmdm3B +- VM sudo cu -l /dev/nmdm-BSDRP.4B 
-- VM : cu -l /dev/nmdm4B+- VM sudo cu -l /dev/nmdm-BSDRP.3B
 </code> </code>
  
-===== Special notes for VLAN user ===== 
  
-Do not uses the default interface vlan name assignment (like "igb0.10"), because the underlying tool (netgraph) doesn't support interface name that includes a dot. 
  
 ===== Configuring Routers ===== ===== Configuring Routers =====
Line 65: Line 61:
 <code> <code>
 sysrc hostname=R1 \ sysrc hostname=R1 \
 +  kld_list+="carp" \
   ifconfig_vtnet3="inet 192.168.1.1/24" \   ifconfig_vtnet3="inet 192.168.1.1/24" \
   ifconfig_vtnet4="inet 192.168.2.1/24" \   ifconfig_vtnet4="inet 192.168.2.1/24" \
-  freevrrpd_enable=YES +  ifconfig_vtnet3_alias0="inet 192.168.1.254/32 vhid 1 vrrpprio 101 pass vrid1 carpver 3" \ 
-cat <<EOF > /usr/local/etc/freevrrpd.conf  +  ifconfig_vtnet4_alias0="inet 192.168.2.254/32 vhid 2 vrrpprio 101 pass vrid2 carpver 3" 
-[VRID] +echo 'net.inet.carp.preempt=1' >> /etc/sysctl.conf 
-serverid = 1 +kldload carp 
-interface = vtnet3 +service hostname restart
-# This router is the master +
-priority = 101 +
-addr = 192.168.1.254/24 +
-# We want that this state is dependant with the state of vrid 2 +
-vridsdep = 2 +
-password = vrid1 +
- +
-[VRID] +
-serverid = 2 +
-interface = vtnet4 +
-# This router is the master +
-priority = 101 +
-addr = 192.168.2.254/24 +
-password vrid2 +
-# We want that this state is dependant with the state of vrid +
-vridsdep = 1 +
-EOF+
 service netif restart service netif restart
-service freevrrpd start+sysctl net.inet.carp.preempt=1
 config save config save
 </code> </code>
Line 98: Line 78:
 <code> <code>
 sysrc hostname=R2 \ sysrc hostname=R2 \
 +  kld_list+="carp" \
   ifconfig_vtnet3="inet 192.168.1.2/24" \   ifconfig_vtnet3="inet 192.168.1.2/24" \
   ifconfig_vtnet4="inet 192.168.2.2/24" \   ifconfig_vtnet4="inet 192.168.2.2/24" \
-  freevrrpd_enable=YES +  ifconfig_vtnet3_alias0="inet 192.168.1.254/32 vhid 1 vrrpprio 100 pass vrid1 carpver 3" \ 
-cat <<EOF > /usr/local/etc/freevrrpd.conf  +  ifconfig_vtnet4_alias0="inet 192.168.2.254/32 vhid 2 vrrpprio 100 pass vrid2 carpver 3" 
-[VRID] +echo 'net.inet.carp.preempt=1' >> /etc/sysctl.conf 
-serverid = 1 +kldload carp 
-interface = vtnet3 +service hostname restart
-# This router is the backup +
-priority = 100 +
-addr = 192.168.1.254/24 +
-# We want that this state is dependant with the state of vrid 2 +
-vridsdep = 2 +
-password = vrid1 +
- +
-[VRID] +
-serverid = 2 +
-interface = vtnet4 +
-# This router is the backup +
-priority = 100 +
-addr = 192.168.2.254/24 +
-password vrid2 +
-# We want that this state is dependant with the state of vrid +
-vridsdep = 1 +
-EOF+
 service netif restart service netif restart
-service freevrrpd start+sysctl net.inet.carp.preempt=1
 config save config save
 </code> </code>
Line 205: Line 169:
 Disable one interface on R1 for changing the VRRP states: Disable one interface on R1 for changing the VRRP states:
 <code> <code>
- +root@R1:~ # ifconfig vtnet3 down 
-[root@R1]~# ifconfig vtnet3 down +root@R1:~ # grep carp /var/log/messages 
-Nov  5 11:48:40 R1 freevrrpd[1178]: can't write to socketNetwork is down +Feb 27 09:19:11 router kernelcarp1@vtnet3MASTER -> INIT (hardware interface down) 
-Nov  5 11:48:40 R1 freevrrpd[1178]There is a big problem here ! +Feb 27 09:19:11 router kernelcarp: demoted by 240 to 240 (interface down) 
-Nov  5 11:48:42 R1 freevrrpd[1178]: interface vtnet3 is faulty, deactivated from VRRP VRIDs +Feb 27 09:19:11 router kernel: carp: 2@vtnet4: MASTER -> BACKUP (more frequent advertisement received)
-Nov  5 11:48:42 R1 freevrrpd[1178]VRID (interface vtnet4) has been deactivated due to dependance+
 </code> </code>
  
Line 216: Line 179:
  
 <code> <code>
-[root@R2]~#tail -f /var/log/messages +root@R2:~ # grep carp /var/log/messages 
-Nov  5 11:48:45 R2 freevrrpd[2092]server state vrid 1: master +Feb 27 09:19:11 router kernelcarp2@vtnet4: BACKUP -> MASTER (preempting a slower master) 
-Nov  5 11:48:48 R2 freevrrpd[2092]server state vrid 2: master+Feb 27 09:19:15 router kernelcarp1@vtnet3: BACKUP -> MASTER (master timed out)
 </code> </code>
  
documentation/examples/simple_vrrp_lab.1772153006.txt.gz · Last modified: by olivier

Except where otherwise noted, content on this wiki is licensed under the following license: BSD 2-Clause
Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki