DHCP probing script version 0.1

11 views
Skip to first unread message

Pablo Piaggio

unread,
Oct 6, 2016, 12:45:38 AM10/6/16
to The HomeFrontRouter Project

Code: https://github.com/HomeFrontRouter/unstable-firewall/tree/master/interfaces

Problem


What happens if the person who installs the (homefront) router for the first time, doesn't know, or don't care, which Ethernet port should be used for WAN and which one is for the LAN?

Design

From my previous experience with the Banana Pi I learned that some network interfaces may not be available after boot if they haven't been brought up by the 'ifup' command.

Since the file '/etc/network/interfaces' works as the configuration file for ifup/ifdown commands, I decided to declare both interfaces on the interfaces file. However, by using the 'manual' option, they are not really configured. As a result, they both are available after boot (listed on ifconfig, and ip commands). See interfaces.inactive file

Choosing the tool to probe/query a DHCP server
  • tcpdump
  • dhcpdump
  • dhcp-probe
  • dhclient
The *dump tools only listen to the network, and require another program to do the DHCP request.

dhcp-probe does the request, and logs the response.

dhclient also does the request, logs the response, and it is already installed. By default runs a setup script (dhclient-script), but it can be run with other options to avoid the standard behavior.

What to do when you finally know

Options:
  1. configure the interfaces manually using with tools like ip and ifup.
  2. create a new interfaces file that reflects the discovery and restart the networking service (using either 'service' or 'systemctl').

I opted for the last one using a template (interfaces.template)

Comments? Suggestions?
Reply all
Reply to author
Forward
0 new messages