I’ve been working with the Beaglebone Black Rev C with Debian. I want to have a static IP address if there is no DHCP server available.
The DHCP client I am using is dhclient.
To do so, I installed and plan to use the dhcping command using the command “apt-get install dhcping”
When there is no DHCP server, I start an alias interface using the ifconfig command and the last known IP address: “ifconfig eth0:0 ”
I’m using the dhcping command as follows to find out if any DHCP servers are on the network: “sudo dhcping –c <eth0:0 IP address> -s 255.255.255.255”
After the DHCP server is turned off and the IP on eth0 expires, I set the alias interface with the above ifconfig command. I then turned the DHCP back on and tried to issue the dhcping command. I receive “no answer” (meaning no DHCP server) which is not what I expect after having turned on the DHCP server. However, if I enter the DHCP servers IP address after the –s argument (i.e. “sudo dhcping –c –s 192.168.12.1”), I get an answer (meaning DHCP server available). Using “dhcpdump –i eth0”, issuing dhcping to 255.255.255.255 shows no activity whereas issuing dhcping to 192.168.12.1 shows the expected activity.
I found that this is directly related to the interface eth0 not having an IP address. With eth0 up, the dhcping command with 255.255.255.255 works as expected. Without any IP address on eth0, no answer is received, despite it being connected to the server.
I presume it has to do with how the dhclient releases an IP address when a lease expires. I would like to make this robust enough to move from network to network with no issues. So if possible, I would like to issue the dhcping command to all available servers instead of just one specific one.
Does anyone know why this is the case? Is there any way I can work around this?