Multiple WAN interfaces and Dynamic DNS

Home Page Forums Network Management ZeroShell Multiple WAN interfaces and Dynamic DNS

  • This topic is empty.
Viewing 8 posts - 16 through 23 (of 23 total)
  • Author
  • #50509

    Well done, I’ll give it a try and check with the results. Send an email to Fulvio to let him know of your patch so he can test it too.


    I’m send Fulvio an email.

    Also, as I said, I been doing some testing and I’ve found 2 small problems.

    1) The code I wrote to get the gw ip address was testing if the ethernet interface was DHCP based and if the interface was active. It turns out that the “if active” test causes a minor glitch in “routeupd” as it expects the old gateway IP to be able to properly remove the route. This is hard to notice because “failoverd” will eventually correct the problem.

    The fixed version for my nb_getgwip 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
    IP=`cat $DHCP/leases 2>/dev/null | grep routers | awk 'END{sub(/;/,"") ; print $3}'`
    echo $IP

    2) nb_setnexthop has an odd behavior when deleting the existing default routes (just before adding the new ones). When a DHCP interface comes up, dhcpclient will add a standard default route for the newly aquired configuration. Like the previous state it needs to be purged to allow for the correct “nexthop” entry. It turns out that a single “ip ro del default” command only deletes the newly added DHCP route, leaving any other route there. This will cause the “ip ro add default $NEXTHOP” to fail and the routes to remain invalid. The solution here is simple: just add an extra “ip ro del defaul”. Doing it twice ensure that the default route is not set, as required.

    The code near the end of nb_setnexthop must read:

    if [ "$CHANGE" = yes ] ; then
    ip ro del default 2>/dev/null
    ip ro del default 2>/dev/null # Required to really delete in some cases, or add will not work correctly
    /usr/latest/ip ro add default $NEXTHOP
    echo $ACTIVEGW > /tmp/nb/ActiveGW
    logger -t NetBalancer "Default Route has been changed: $NEXTHOP"

    I’ve tried several combinations of faults and it seems to be working fine.


    Okay dumb question…

    aviegas, if our zeroshell (beta 13) is running off of a USB flash drive, what is the correct way to add your modifications so they are there on reboots?


    System -> Setup -> Startup/Cron
    Add your modification here in a preboot or postboot script.


    I’m sorry but I do not understand… How do you modify the kerby script using a pre-boot or a post-boot script?

    And would the modification be pre or post boot?


    Make the modification you want and save it on a file, for example in


    Then add a preboot script to erase the old file

    rm /root/kerbynet.cgi/......

    and copy the modified file to its place

    cp /Database/patch /root/kerbynet.cgi/fileneme

    If you want to copy modied files use preboot. If you want to start services or run scripts use postboot.


    Hi all,

    I have a need also to update 2 DDNS host names over 2 wan connections. One is router and other is cable modem.
    Was wondering if this was implemented in newer versions of zeroshell. I could not find this option but it would be nice to have it instead of trying to patch the actual one.


    You can try to use a DDNS service that accept the IP as a variable and then use a script to extract the IP and post it to DDNS server.
    I use Joker on my domain and has this options.

    You will need about a 4 lines script that will go into cron section.


    #get IPs
    IP1=$(ifconfig ETH01 | awk '/inet addr/{print substr($2,6)}')
    IP2=$(ifconfig ETH02 | awk '/inet addr/{print substr($2,6)}')

    #post IPs
    curl "$IP1"
    curl "$IP2"
Viewing 8 posts - 16 through 23 (of 23 total)
  • You must be logged in to reply to this topic.