I have recently been able to spend sometime working with Raspberry Pi’s both for personal projects as well as a few things for work. This seems like a great opportunity to do a series of posts on them! The first post will be around utilizing both NICs at the same time to allow for “Out Of Band” management of the Pi while using the other NIC for network testing.
This will be one of hopefully many posts around this topic.
First a quick background:
The Raspberry Pi is an interesting mini computer that comes in a few different form factors and a very low price point. The GPIO (General Purpose Input/Output) connectivity allows for some really neat projects. The Raspberry Pi can run any OS that will run on the CPU, but the primary OS is Raspbian. Raspbian is a version of Linux optimized to work efficiently on the Raspberry Pi hardware platform. The newest version (3 Model B+) includes both built in Gigabit Ethernet NIC and a Dual Band wireless AC NIC.
***As always, make sure to have appropriate backups prior to making any changes. It is also highly recommended to do all development work in a test environment not attached to any production environment. Following any of the provided steps or using any of the provided information is at the users own risk.***
Now for the good stuff:
This setup is intended to utilize the Wired NIC as the management interface while all testing will be performed through the wireless NIC. This allows for remote wireless connectivity testing at locations without having to have a onsite tester, as well as provides the ability to perform general RF spectrum health analysis. This is accomplished by having the primary preferred default route over the wireless NIC and a more specific route to the management endpoint (or subnet) over the wired NIC.
The default behavior when connected to both a wired and wireless NIC is to allow both connections with each having a default route, wired having a lower metric and preferred over the higher metric of the wireless NIC:
To start off, and to make sure connectivity is never lost, configure the static route that forces traffic destined to the management PC / subnet over the wired NIC. To do this a new file called “40-route” needs to be created in “/lib/dhcpcd/dhcpd-hooks/” that contains the static route entry:
After the file is created and saved restart dhcpcd services and make sure the route entry is added into the route table:
To prefer a specific interface (such as the Wireless NIC, for testing of the Wireless environment) the metric for the interface needs to be set to a lower value. I also recommend setting the management interface to a higher value so that it is always higher then the preferred testing interface. To do this edit the file “dhcpcd.conf” using your favorite editor to include the interface metric configurations as shown below:
Once the file is edited and saved, restart dhcpcd services and make sure the new metrics are shown in the route table:
Once setup and verified all primary traffic not destined for any directly connected subnets or the static route assigned will use the more preferred (lower metric) interface.
Now that the Raspberry Pi is setup, you can deploy a low cost network monitor probe using tools such as iperf, IP SLA, or any other responder software that you want to be forced over a specific medium for testing at a location.