Reply To: Multiple WAN interfaces and Dynamic DNS

Forums Network Management ZeroShell Multiple WAN interfaces and Dynamic DNS Reply To: Multiple WAN interfaces and Dynamic DNS


Ok, I’m currently testing some mods that seems to get this (NB with DHCP) working.

I’ve determined the “issue” to be the way the default gateway IP address is determined for each NB gateway. Basically the code retrieves the value that is stored for each NB gateway condiguration. The issue is that in the case of a DHCP ethernet link, this will blank.

So I’ve opted for creating a new script that will CORRECTLY retrieve the gateway address. The logic is as follows:

a) Retrieve the gateway IP address from the configuration
b) If the IP address is “blank”, it means a dynamic interface (such as PPPoE, DHCP, etc).
c) For a dynamic interface, if it’s a DHCP interface, retrieve the gateway IP from the leases file

This will give the correct IP for the 3 possible cases:

1) It was defined in the NB gateway settings (typically for a fixed address Ethernet)
2) Only the Interface was defined and DHCP is NOT in use (typically PPPoE)
3) Only the Interface was defined and DHCP IS in use (the case in question here)

The code I’ve written to implement this is:


. /etc/kerbynet.conf
IP=`cat $GW/IP 2>/dev/null`
if [ -z "$IP" ] ; then
INTERFACE=`cat $GW/Interface 2>/dev/null`
if [ -n "$INTERFACE" ] ; then
STATUS=`cat $DHCP/Status 2>/dev/null`
if [ "$STATUS" = Enabled ]; then
IP=`cat $DHCP/leases 2>/dev/null | grep routers | awk 'END{sub(/;/,"") ; print $3}'`

Then it was a matter of checking several scripts for any place to use the above code. The idea is to look for place where the IP is retrieved and if it is blank, a point-to-point interface is assume. By changing (actually making it more complete) the way the IP address is retrieved it allows the “empty” IP test to work, as the Ethernet with DHCP will now have a default gateway IP address and it will behave as a normal Ethernet with a default gateway.

I’ve found this test to exist on: nb_setnexthop, routeupd and failoverd (2 times) scripts.

The change was:

IP=`cat $GW/IP 2>/dev/null`


IP=`$SCRIPTS/nb_getgwip $G`

(for failoverd the variable is not “IP”, but “cIP” and “W”)

I’ve done some initial testing and I can enable/disable the NB, as well as bring either interface to faul (one is PPPoE and the other is the DHCP). I will keep this running for a while and see how it behaves. I will post any relevant finding.