====== Maximum BSDRP features lab ======
{{description>Complex example showing some of available features}}
This lab is used for testing BSDRP before releasing new version.
===== Presentation =====
==== Network diagram ====
Here is the logical and physical view:
{{:documentation:examples:maximum_bsdrp_features_lab.png|}}
===== Setting-up the lab =====
==== Downloading BSD Router Project images ====
Download BSDRP serial image (prevent to have to use an X display) on Sourceforge.
==== Download Lab scripts =====
More information on these BSDRP lab scripts available on [[documentation:examples:How to build a BSDRP router lab]].
Start the lab with full-meshed 6 routers.
An example with bhyve under FreeBSD:
tools/BSDRP-lab-bhyve.sh -i /usr/obj/BSDRP.amd64/BSDRP-1.80-full-amd64-serial.img.xz -n 5 -e
Setting-up a virtual lab with 5 VM(s):
- Working directory: /tmp/BSDRP
- Each VM have 1 core(s) and 256M RAM
- Emulated NIC: e1000
- Switch mode: bridge + tap
- 0 LAN(s) between all VM
- Full mesh Ethernet links between each VM
VM 1 have the following NIC:
- em0 connected to VM 2
- em1 connected to VM 3
- em2 connected to VM 4
- em3 connected to VM 5
VM 2 have the following NIC:
- em0 connected to VM 1
- em1 connected to VM 3
- em2 connected to VM 4
- em3 connected to VM 5
VM 3 have the following NIC:
- em0 connected to VM 1
- em1 connected to VM 2
- em2 connected to VM 4
- em3 connected to VM 5
VM 4 have the following NIC:
- em0 connected to VM 1
- em1 connected to VM 2
- em2 connected to VM 3
- em3 connected to VM 5
VM 5 have the following NIC:
- em0 connected to VM 1
- em1 connected to VM 2
- em2 connected to VM 3
- em3 connected to VM 4
To connect VM'serial console, you can use:
- VM 1 : cu -l /dev/nmdm-BSDRP.1B
- VM 2 : cu -l /dev/nmdm-BSDRP.2B
- VM 3 : cu -l /dev/nmdm-BSDRP.3B
- VM 4 : cu -l /dev/nmdm-BSDRP.4B
- VM 5 : cu -l /dev/nmdm-BSDRP.5B
===== Routers configuration =====
In this order for avoiding DHCP client timeout problems.
All these routers can be configured with labconfig tool (use it only on a lab, because it will replace your current running configuration):
labconfig full_vm[VM-NUMBER]
==== Router 5 (including jail5 and jail6) ====
(you can use script “labconfig vm5” for automatically pushing full configuration):
sysrc hostname=R5 \
ifconfig_em3=up \
cloned_interfaces=epair0 \
ifconfig_epair0a=up \
kld_list+=" if_lagg carp"
ifconfig -l | grep -q vtnet && sed -i "" 's/em/vtnet/g' /etc/rc.conf
cat > /etc/devfs.rules < /etc/jails/jail5/local/dhcpd.conf < /etc/jails/jail5/local/frr/frr.conf < /etc/jails/jail5/local/nfacctd.conf<
==== Router 2 ====
(you can use script “labconfig vm2” for automatically pushing full configuration):
sysrc hostname=R2
sysrc rtadvd_enable=YES
sysrc rtadvd_interfaces="em0"
sysrc vlans_em1="23"
sysrc ifconfig_em1="up mtu 1528"
sysrc ifconfig_em0="inet 10.0.12.2/24"
sysrc ifconfig_em0_ipv6="inet6 2001:db8:12::2 prefixlen 64"
sysrc ifconfig_em1_23="inet 10.0.23.2/24"
sysrc ifconfig_em1_23_ipv6="inet6 2001:db8:23::2 prefixlen 64"
sysrc cloned_interfaces="lo1"
sysrc ifconfig_lo1="inet 10.0.0.2/32"
sysrc ifconfig_lo1_ipv6="inet6 2001:db8::2 prefixlen 128"
sysrc frr_enable=YES
sysrc frr_vtysh_boot=YES
sysrc dhcprelya_enable=YES
sysrc dhcprelya_servers="10.0.45.5"
sysrc dhcprelya_ifaces=em0
sysrc mpd_enable=YES
sysrc mpd_flags="-b -s ppp"
sysrc ipsec_enable=YES
sysrc ipsec_file="/etc/ipsec.conf"
sysrc pimd_enable=YES
sysrc freevrrpd_enable=YES
ifconfig -l | grep -q vtnet && sed -i "" 's/em/vtnet/g' /etc/rc.conf
cat > /usr/local/etc/freevrrpd.conf < /usr/local/etc/mpd5/if-up.sh < /usr/local/etc/mpd5/mpd.conf < /usr/local/etc/mpd5/mpd.secret < /etc/ipsec.conf < /usr/local/etc/frr/frr.conf <
==== Router 3 ====
(you can use script “labconfig vm3” for automatically pushing full configuration):
sysrc hostname=R3
sysrc vlans_em1="23"
sysrc ifconfig_em1="up mtu 1528"
sysrc ifconfig_em1_23="inet 10.0.23.3/24"
sysrc ifconfig_em1_23_ipv6="inet6 2001:db8:23::3 prefixlen 64"
sysrc ifconfig_em2="inet 10.0.34.3/24 mtu 1528"
sysrc ifconfig_em2_ipv6="inet6 2001:db8:34::3 prefixlen 64"
sysrc bird_enable=YES
sysrc pf_enable=YES
sysrc pf_rules="/etc/pf.conf"
ifconfig -l | grep -q vtnet && sed -i "" 's/em/vtnet/g' /etc/rc.conf
cat > /etc/pf.conf < R4)
# Rate-limit inet 4 VPN traffic to 10Mb
#altq on \$TO_R4_if hfsc bandwidth 100Mb queue { VPN4_TO_R4, OTHER_TO_R4 }
#queue VPN4_TO_R4 bandwidth 10Mb hfsc(upperlimit 10Mb)
#queue OTHER_TO_R4 bandwidth 90Mb hfsc(default)
# Queue for outgoing traffic from \$TO_R2_if (R4 => R2)
#altq on \$TO_R2_if hfsc bandwidth 100Mb queue { VPN4_TO_R2, OTHER_TO_R2 }
#queue VPN4_TO_R2 bandwidth 10Mb hfsc(upperlimit 10Mb)
#queue OTHER_TO_R2 bandwidth 90Mb hfsc(default)
## PF rules
# R2 => R4
# Shapping works on outgoing traffic only, but need to 'mark' traffic
# entering the interface for putting returning traffic in the good queue
#pass in quick on \$TO_R2_if proto gre from \$R2 to \$R4 queue VPN4_TO_R2
# Apply ALTQ to traffic that get out from \$TO_R4_if
#pass out quick on \$TO_R4_if proto gre from \$R2 to \$R4 queue VPN4_TO_R4
# PF rules R4 => R2
#pass in quick on \$TO_R4_if proto gre from \$R4 to \$R2 queue VPN4_TO_R4
#pass out quick on \$TO_R2_if proto gre from \$R4 to \$R2 queue VPN4_TO_R2
# ALTQ is disabled since BSDRP 1.81 (too much performance impact)
pass all
EOF
cat > /usr/local/etc/bird.conf <
==== Router 4 ====
(you can use script “labconfig vm4” for automatically pushing full configuration):
sysrc hostname=R4
sysrc ifconfig_em3="inet 10.0.45.4/24"
sysrc ifconfig_em3_ipv6="inet6 2001:db8:45::4 prefixlen 64"
sysrc ifconfig_em2="10.0.34.4/24 mtu 1528"
sysrc ifconfig_em2_ipv6="inet6 2001:db8:34::4 prefixlen 64"
sysrc cloned_interfaces="lo1"
sysrc ifconfig_lo1="inet 10.0.0.4/32"
sysrc ifconfig_lo1_ipv6="inet6 2001:db8::4 prefixlen 128"
sysrc frr_enable=YES
sysrc frr_vtysh_boot=YES
sysrc mpd_enable=YES
sysrc mpd_flags="-b -s ppp"
sysrc firewall_enable=YES
sysrc firewall_script="/etc/ipfw.rules"
sysrc ipfw_netflow_enable=YES
sysrc ipfw_netflow_ip=10.0.45.5
sysrc ipfw_netflow_port=2055
sysrc ipfw_netflow_version=9
sysrc pimd_enable=YES
ifconfig -l | grep -q vtnet && sed -i "" 's/em/vtnet/g' /etc/rc.conf
cat > /usr/local/etc/frr/frr.conf < /usr/local/etc/mpd5/if-up.sh < /usr/local/etc/mpd5/mpd.conf < /usr/local/etc/mpd5/mpd.secret <> /etc/sysctl.conf
echo "net.inet6.ip6.fw.deny_unknown_exthdrs=0" >> /etc/sysctl.conf
cat > /etc/ipfw.rules <
==== Router 1 ====
This router will be used for backuping all other routers configuration files, then it need a root password for enabling SSH access to it.
We will use "root" password for this lab.
sysrc hostname=R1 \
gateway_enable=NO \
ipv6_gateway_enable=NO \
ifconfig_em0=up \
cloned_interfaces=lagg0 \
ifconfig_lagg0="laggproto loadbalance laggport em0 SYNCDHCP" \
ifconfig_lagg0_ipv6="inet6 accept_rtadv" \
sshd_enable=yes
ifconfig -l | grep -q vtnet && sed -i "" 's/em/vtnet/g' /etc/rc.conf
config save
hostname R1
service routing restart
service netif restart
service sshd start
===== Final testing =====
==== IPv4 traffic shaping ====
From R5, enter jail6 console and launch iperf in IPv4 (default) mode:
[root@R5]~# service jail console jail6
Last login: Sun Jul 2 16:44:12 on ttyu0
BSD Router project (BSDRP) (c) 2009-2017, The BSDRP Development Team
All rights reserved.
BSDRP is under the Simplified BSD license.
Documentation: http://bsdrp.net
Discover BSDRP tools with "help" command
Keyboard layout can be changed with this command:
kbdcontrol -l keymap_file ( for list available maps)
root has logged on ttyu0 from local.
[root@jail6]~# iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Start an iperf3 client on R1, and check available bandwidth is about 10Mb/s:
[root@R1]~# iperf3 -c 10.0.56.6
Connecting to host 10.0.56.6, port 5201
[ 5] local 10.0.12.1 port 20434 connected to 10.0.56.6 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 1.04 MBytes 8.73 Mbits/sec 0 56.7 KBytes
[ 5] 1.00-2.00 sec 1.15 MBytes 9.65 Mbits/sec 1 52.3 KBytes
[ 5] 2.00-3.00 sec 1.14 MBytes 9.55 Mbits/sec 2 49.6 KBytes
[ 5] 3.00-4.00 sec 1.13 MBytes 9.51 Mbits/sec 1 43.8 KBytes
[ 5] 4.00-5.00 sec 1.13 MBytes 9.46 Mbits/sec 1 38.1 KBytes
[ 5] 5.00-6.00 sec 1.15 MBytes 9.66 Mbits/sec 1 35.3 KBytes
[ 5] 6.00-7.00 sec 1.15 MBytes 9.61 Mbits/sec 1 1.41 KBytes
[ 5] 7.00-8.00 sec 1.14 MBytes 9.59 Mbits/sec 0 65.1 KBytes
[ 5] 8.00-9.00 sec 1.14 MBytes 9.57 Mbits/sec 1 60.9 KBytes
[ 5] 9.00-10.00 sec 1.14 MBytes 9.54 Mbits/sec 1 58.0 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 11.3 MBytes 9.49 Mbits/sec 9 sender
[ 5] 0.00-10.04 sec 11.3 MBytes 9.41 Mbits/sec receiver
iperf Done.
==== IPv6 traffic shaping ====
One jail6, display its autoconfigured inet6 address:
[root@jail6]~# ifconfig lagg0 inet6 | grep autoconf
inet6 2001:db8:56:0:ff:ff:fe00:80b prefixlen 64 autoconf
Start an iperf3 ipv6 client on R1, and check available bandwith is about 20Mb/s:
[root@R1]~# iperf3 -c 2001:db8:56:0:cf:8fff:fea9:490b
Connecting to host 2001:db8:56:0:cf:8fff:fea9:490b, port 5201
[ 5] local 2001:db8:12:0:5a9c:fcff:fe01:201 port 62845 connected to 2001:db8:56:0:cf:8fff:fea9:490b port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 1.74 MBytes 14.6 Mbits/sec 0 68.2 KBytes
[ 5] 1.00-2.00 sec 2.23 MBytes 18.7 Mbits/sec 3 65.2 KBytes
[ 5] 2.00-3.00 sec 2.19 MBytes 18.3 Mbits/sec 2 77.6 KBytes
[ 5] 3.00-4.00 sec 2.19 MBytes 18.3 Mbits/sec 8 57.1 KBytes
[ 5] 4.00-5.00 sec 2.19 MBytes 18.3 Mbits/sec 2 38.0 KBytes
[ 5] 5.00-6.00 sec 2.19 MBytes 18.3 Mbits/sec 1 61.2 KBytes
[ 5] 6.00-7.00 sec 2.19 MBytes 18.4 Mbits/sec 2 42.1 KBytes
[ 5] 7.00-8.00 sec 2.19 MBytes 18.3 Mbits/sec 1 61.2 KBytes
[ 5] 8.00-9.00 sec 2.19 MBytes 18.3 Mbits/sec 2 44.8 KBytes
[ 5] 9.00-10.00 sec 2.18 MBytes 18.3 Mbits/sec 1 65.3 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 21.5 MBytes 18.0 Mbits/sec 22 sender
[ 5] 0.00-10.03 sec 21.3 MBytes 17.8 Mbits/sec receiver
iperf Done.
[root@R1]~#
And during iperf, R4 ipfw pipe showing some activity:
root@R4:~ # ipfw pipe show
00040: 10.000 Mbit/s 0 ms burst 0
q131112 50 sl. 0 flows (1 buckets) sched 65576 weight 0 lmax 0 pri 0 droptail
sched 65576 type FIFO flags 0x0 0 buckets 0 active
00041: 10.000 Mbit/s 0 ms burst 0
q131113 50 sl. 0 flows (1 buckets) sched 65577 weight 0 lmax 0 pri 0 droptail
sched 65577 type FIFO flags 0x0 0 buckets 0 active
00061: 20.000 Mbit/s 0 ms burst 0
q131133 50 sl. 0 flows (1 buckets) sched 65597 weight 0 lmax 0 pri 0 droptail
sched 65597 type FIFO flags 0x0 0 buckets 1 active
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
0 ip 0.0.0.0/0 0.0.0.0/0 483 378358 9 6349 0
00060: 20.000 Mbit/s 0 ms burst 0
q131132 50 sl. 0 flows (1 buckets) sched 65596 weight 0 lmax 0 pri 0 droptail
sched 65596 type FIFO flags 0x0 0 buckets 1 active
0 ip 0.0.0.0/0 0.0.0.0/0 125 15881 0 0 0
==== netflow ====
Check that netflows are collected on jail5 (/tmp/file-date-hour.txt):
[root@jail5]~# ls /tmp/file-*
/tmp/file-20170630-0000.txt /tmp/file-20170630-0025.txt
/tmp/file-20170630-0005.txt /tmp/file-20170630-0030.txt
/tmp/file-20170630-0010.txt /tmp/file-20170630-0035.txt
/tmp/file-20170630-0015.txt /tmp/file-20170630-0040.txt
/tmp/file-20170630-0020.txt
==== SNMP ====
From R1, get 2 SNMP values of R6:
* The basic sysname
* The UCD module version
[root@R1]~# bsnmpget -s 10.0.56.6 sysName.0
sysName.0 = jail6
[root@R1]~# bsnmpwalk -s 10.0.56.6 1.3.6.1.4.1.2021.100.2.0
1.3.6.1.4.1.2021.100.2.0 = $Name: bsnmp-ucd-0-4-3 $
==== Configurations files network backup ====
R1 will be use as a configuration files backup repository
=== Mounting data partition on R1 and configure root password ===
[root@R1]~# mount /data/
[root@R1]~# passwd
Changing local password for root
New Password:
Retype New Password:
=== Sending configuration archive file to R1 ===
From all others routers, send the configuration file to the /data partition of R1:
[root@R2]/# config put scp root@10.0.12.1:/data/R2.tar.xz
Send saved configuration by SCP to root@10.0.12.1:/data/R2.tar.xz
The authenticity of host '10.0.12.1 (10.0.12.1)' can't be established.
RSA key fingerprint is 4d:e9:ce:26:d4:2f:92:15:5e:06:97:a8:83:78:0c:e5.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.12.1' (RSA) to the list of known hosts.
Password:
config.3803.tar.xz 100% 7100 6.9KB/s 00:00
==== System integrity check ====
Download the mtree reference file corresponding to your BSDRP release and start a system integrity check.
In this lab, we put the reference file in the /tmp folder of R1:
[root@R1]~# system integrity /tmp/BSDRP-1.4-amd64-serial.mtree.xz
Here is the modified files comparing to the reference mtree file:
dev extra
etc extra
tmp extra
var extra
Extra files and folder are normal regarding your previous tests.