documentation:examples:simple_vrrp_lab
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| documentation:examples:simple_vrrp_lab [2026/02/27 01:43] – [Forwarding and ARP entry] olivier | documentation:examples:simple_vrrp_lab [2026/02/27 09:55] (current) – [Starting the lab] olivier | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| < | < | ||
| - | # ./ | + | # ./ |
| - | vmm module not loaded. Loading it... | + | |
| - | nmdm module not loaded. Loading it... | + | |
| - | if_tap module not loaded. Loading it... | + | |
| - | BSD Router Project (http:// | + | |
| 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/ |
| - | - Each VM have 1 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' | + | To connect |
| - | - 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 3 : cu -l /dev/nmdm3B | + | - VM 4 : sudo cu -l /dev/nmdm-BSDRP.4B |
| - | - VM 4 : cu -l /dev/nmdm4B | + | - VM 3 : sudo cu -l /dev/nmdm-BSDRP.3B |
| </ | </ | ||
| - | ===== Special notes for VLAN user ===== | ||
| - | Do not uses the default interface vlan name assignment (like " | ||
| ===== Configuring Routers ===== | ===== Configuring Routers ===== | ||
| Line 65: | Line 61: | ||
| < | < | ||
| sysrc hostname=R1 \ | sysrc hostname=R1 \ | ||
| + | kld_list+=" | ||
| ifconfig_vtnet3=" | ifconfig_vtnet3=" | ||
| ifconfig_vtnet4=" | ifconfig_vtnet4=" | ||
| - | | + | |
| - | cat <<EOF > / | + | |
| - | [VRID] | + | echo ' |
| - | serverid = 1 | + | kldload carp |
| - | interface = vtnet3 | + | service hostname restart |
| - | # This router is the master | + | |
| - | priority = 101 | + | |
| - | addr = 192.168.1.254/ | + | |
| - | # 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/ | + | |
| - | password | + | |
| - | # We want that this state is dependant with the state of vrid 1 | + | |
| - | vridsdep = 1 | + | |
| - | EOF | + | |
| service netif restart | service netif restart | ||
| - | service freevrrpd start | + | sysctl net.inet.carp.preempt=1 |
| config save | config save | ||
| </ | </ | ||
| Line 98: | Line 78: | ||
| < | < | ||
| sysrc hostname=R2 \ | sysrc hostname=R2 \ | ||
| + | kld_list+=" | ||
| ifconfig_vtnet3=" | ifconfig_vtnet3=" | ||
| ifconfig_vtnet4=" | ifconfig_vtnet4=" | ||
| - | | + | |
| - | cat <<EOF > / | + | |
| - | [VRID] | + | echo ' |
| - | serverid = 1 | + | kldload carp |
| - | interface = vtnet3 | + | service hostname restart |
| - | # This router is the backup | + | |
| - | priority = 100 | + | |
| - | addr = 192.168.1.254/ | + | |
| - | # 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/ | + | |
| - | password | + | |
| - | # We want that this state is dependant with the state of vrid 1 | + | |
| - | vridsdep = 1 | + | |
| - | EOF | + | |
| service netif restart | service netif restart | ||
| - | service freevrrpd start | + | sysctl net.inet.carp.preempt=1 |
| config save | config save | ||
| </ | </ | ||
| Line 205: | Line 169: | ||
| Disable one interface on R1 for changing the VRRP states: | Disable one interface on R1 for changing the VRRP states: | ||
| < | < | ||
| - | + | root@R1:~ # ifconfig vtnet3 down | |
| - | [root@R1]~# ifconfig vtnet3 down | + | root@R1:~ # grep carp / |
| - | Nov 5 11: | + | Feb 27 09:19:11 router kernel: carp: 1@vtnet3: MASTER -> INIT (hardware interface down) |
| - | Nov 5 11:48:40 R1 freevrrpd[1178]: There is a big problem here ! | + | Feb 27 09:19:11 router kernel: carp: demoted by 240 to 240 (interface |
| - | Nov 5 11:48:42 R1 freevrrpd[1178]: interface | + | 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 2 (interface | + | |
| </ | </ | ||
| Line 216: | Line 179: | ||
| < | < | ||
| - | [root@R2]~#tail -f / | + | root@R2:~ # grep carp / |
| - | Nov 5 11:48:45 R2 freevrrpd[2092]: server state vrid 1: master | + | Feb 27 09:19:11 router kernel: carp: 2@vtnet4: BACKUP -> MASTER (preempting a slower |
| - | Nov 5 11:48:48 R2 freevrrpd[2092]: server state vrid 2: master | + | Feb 27 09:19:15 router kernel: carp: 1@vtnet3: BACKUP -> MASTER (master |
| </ | </ | ||
documentation/examples/simple_vrrp_lab.1772153006.txt.gz · Last modified: by olivier
