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

Next revision
Previous revision
documentation:examples:simple_vrrp_lab [2017/07/07 00:23] – created - external edit 127.0.0.1documentation: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>
 +
 +
  
 ===== Configuring Routers ===== ===== Configuring Routers =====
Line 60: Line 60:
  
 <code> <code>
-sysrc hostname=R1 +sysrc hostname=R1 \ 
-sysrc ifconfig_vtnet3="inet 192.168.1.1/24" +  kld_list+="carp"
-sysrc ifconfig_vtnet4="inet 192.168.2.1/24" +  ifconfig_vtnet3="inet 192.168.1.1/24" \ 
-sysrc freevrrpd_enable=YES +  ifconfig_vtnet4="inet 192.168.2.1/24" \ 
-cat <<EOF > /usr/local/etc/freevrrpd.conf  +  ifconfig_vtnet3_alias0="inet 192.168.1.254/32 vhid 1 vrrpprio 101 pass vrid1 carpver 3" \ 
-[VRID] +  ifconfig_vtnet4_alias0="inet 192.168.2.254/32 vhid 2 vrrpprio 101 pass vrid2 carpver 3" 
-serverid = 1 +echo 'net.inet.carp.preempt=1' >> /etc/sysctl.conf 
-interface = vtnet3 +kldload carp 
-# This router is the master +service hostname restart
-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 93: Line 77:
  
 <code> <code>
-sysrc hostname=R2 +sysrc hostname=R2 \ 
-sysrc ifconfig_vtnet3="inet 192.168.1.2/24" +  kld_list+="carp"
-sysrc ifconfig_vtnet4="inet 192.168.2.2/24" +  ifconfig_vtnet3="inet 192.168.1.2/24" \ 
-sysrc freevrrpd_enable=YES +  ifconfig_vtnet4="inet 192.168.2.2/24" \ 
-cat <<EOF > /usr/local/etc/freevrrpd.conf  +  ifconfig_vtnet3_alias0="inet 192.168.1.254/32 vhid 1 vrrpprio 100 pass vrid1 carpver 3" \ 
-[VRID] +  ifconfig_vtnet4_alias0="inet 192.168.2.254/32 vhid 2 vrrpprio 100 pass vrid2 carpver 3" 
-serverid = 1 +echo 'net.inet.carp.preempt=1' >> /etc/sysctl.conf 
-interface = vtnet3 +kldload carp 
-# This router is the backup +service hostname restart
-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 126: Line 94:
  
 <code> <code>
-sysrc hostname=R3 +sysrc hostname=R3 \ 
-sysrc ifconfig_vtnet3="inet 192.168.1.3/24" +  ifconfig_vtnet3="inet 192.168.1.3/24" \ 
-sysrc defaultrouter="192.168.1.254" +  defaultrouter="192.168.1.254" \ 
-sysrc gateway_enable=NO +  gateway_enable=NO \ 
-sysrc ipv6_gateway_enable=NO+  ipv6_gateway_enable=NO
 service netif restart service netif restart
 service routing restart service routing restart
Line 139: Line 107:
  
 <code> <code>
-sysrc hostname=R4 +sysrc hostname=R4 \ 
-sysrc ifconfig_vtnet4="inet 192.168.2.4/24" +  ifconfig_vtnet4="inet 192.168.2.4/24" \ 
-sysrc defaultrouter="192.168.2.254" +  defaultrouter="192.168.2.254" \ 
-sysrc gateway_enable=NO +  gateway_enable=NO \ 
-sysrc ipv6_gateway_enable=NO+  ipv6_gateway_enable=NO
 service netif restart service netif restart
 service routing restart service routing restart
Line 156: Line 124:
  
 <code> <code>
-[root@R1]~# grep vrrp /var/log/messages +root@R1:~ # grep carp /var/log/messages 
-Nov  5 11:37:15 R1 freevrrpd[1177]launching daemon in background mode +Feb 27 01:41:27 R1 kernelcarp1@vtnet3INIT -> BACKUP (initialization complete) 
-Nov  5 11:37:15 R1 freevrrpd[1178]: initializing threads and all VRID +Feb 27 01:41:27 R1 kernelcarp2@vtnet4INIT -> BACKUP (initialization complete) 
-Nov  5 11:37:15 R1 freevrrpd[1178]reading configuration file /usr/local/etc/freevrrpd.conf +Feb 27 01:41:29 R1 kernelcarp: 1@vtnet3BACKUP -> MASTER (preempting a slower master) 
-Nov  5 11:37:15 R1 freevrrpd[1178]monitored circuits engine initialized +Feb 27 01:41:29 R1 kernel: carp: 2@vtnet4BACKUP -> MASTER (preempting a slower master)
-Nov  5 11:37:16 R1 freevrrpd[1178]server state vrid 1: backup +
-Nov  5 11:37:17 R1 freevrrpd[1178]: server state vrid 2: backup +
-Nov  5 11:37:20 R1 freevrrpd[1178]server state vrid 1: master +
-Nov  5 11:37:21 R1 freevrrpd[1178]server state vrid 2: master+
 </code> </code>
  
Line 172: Line 136:
  
 <code> <code>
-[root@R2]~#  grep vrrp /var/log/messages +root@R2:~ # grep carp /var/log/messages 
-Nov  5 11:41:37 R2 freevrrpd[2091]launching daemon in background mode +Feb 27 01:41:26 R2 kernelcarp: 1@vtnet3: INIT -> BACKUP (initialization complete) 
-Nov  5 11:41:37 R2 freevrrpd[2092]initializing threads and all VRID +Feb 27 01:41:26 R2 kernelcarp: 2@vtnet4: INIT -> BACKUP (initialization complete) 
-Nov  5 11:41:37 R2 freevrrpd[2092]reading configuration file /usr/local/etc/freevrrpd.conf +Feb 27 01:41:29 R2 kernelcarp: 1@vtnet3: BACKUP -> MASTER (master timed out) 
-Nov  5 11:41:37 R2 freevrrpd[2092]monitored circuits engine initialized +Feb 27 01:41:29 R2 kernelcarp: 2@vtnet4: BACKUP -> MASTER (master timed out) 
-Nov  5 11:41:38 R2 freevrrpd[2092]server state vrid 1: backup +Feb 27 01:41:29 R2 kernel: carp: 1@vtnet3MASTER -> BACKUP (more frequent advertisement received) 
-Nov  5 11:41:39 R2 freevrrpd[2092]server state vrid 2: backup+Feb 27 01:41:29 R2 kernel: carp: 2@vtnet4MASTER -> BACKUP (more frequent advertisement received)
 </code> </code>
  
Line 193: Line 157:
 64 bytes from 192.168.2.4: icmp_seq=2 ttl=63 time=0.718 ms 64 bytes from 192.168.2.4: icmp_seq=2 ttl=63 time=0.718 ms
 </code> </code>
 +
 And checking ARP cache for a VRRP MAC address (00:00:5e:00:01:xx) And checking ARP cache for a VRRP MAC address (00:00:5e:00:01:xx)
  
 <code> <code>
-[root@R3]~#arp -na | grep 192.168.1.254 +root@R3:~ # arp -na | grep 192.168.1.254 
-? (192.168.1.254) at 00:00:5e:00:01:01 on vtnet3 expires in 709 seconds [ethernet] +? (192.168.1.254) at 00:00:5e:00:01:01 on vtnet3 expires in 1191 seconds [ethernet]
 </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.1499379822.txt.gz · Last modified: by 127.0.0.1

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