1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Hyperwrt Thibor with Half-Bridge ADSL modem

Discussion in 'HyperWRT Firmware' started by mstombs, May 14, 2007.

  1. mstombs

    mstombs Network Guru Member

    After spending months hacking my ADSL2MUE to work in 'true' half-bridge alongside my WRT54GS I find it doesn't work. Modem now seems to work fine in this mode with windows XP and a Linux 2.6.20 PC.

    Does anyone else have Thibor working with a half bridge ADSL modem, if so does the modem pass on the details as provided by ISP? ie

    IP address 89.241.xxx.yyy
    netmask 255.255.255.255
    Gateway 89.241.aaa.bbb

    I don't think the WRT54GS likes the gateway not being in the same network as the IP address - is there a simple route command in Thibor that will fix it or do I need to learn how to hack the firmware - suspect a kernel or udhcpc patch needed?

    I guess this is why various modem manufacturers fake either the netmask or Gateway. i.e. D-Link zipb sets Gateway = IP address which gives arp table problems on the router.
     
  2. Thibor

    Thibor Super Moderator Staff Member Member

    i had it running with a zipb modem without issues once i had the modem doing what i wanted it to do. sorry i can't be of more help but it worked for me, the issue at my end was the modem and not the router. you're right about the arp table issues with a d-link too, it fills rather quickly.
     
  3. mstombs

    mstombs Network Guru Member

    I managed to compile and run a modem kernel patch to an arp.c which could generate the same arp symptoms, but D-Link zipb also leaves NAT running on the modem (but not actually needed) so I gave up trying to copy what it does.

    Browsing Thibor sources on Google - I think I can see where a patch would work for me - just need to change/add a route command in the new_renew function in udhpc.c, to a similar one used for pptp in services.c. I can check my theory from the command line - but may be gone some time before I can dare try a patch (small problem of learning how to compile first, of course!)- my Thibor router is 'mission critical' and very reliable on a cable connection at home I am just playing with dsl!
     
  4. Thibor

    Thibor Super Moderator Staff Member Member

    you could put it in the firewall script as this is run each time udhcpc is called, ie: when the wan goes down for whatever reason.
     
  5. mstombs

    mstombs Network Guru Member

    This is a 'feature' that the seems to be common to Hyperwrt, Tomato and ddwrt judging by my googling.

    Hyperwrt Thibor is receiving the gateway address fine and displaying on the web screen but doesn't correctly set the route.

    I can fix my problem from the Thibor run command using the following commands:-

    Code:
    route add -host 89.241.aaa.bbb dev vlan1
    route add default vlan1
    This tells the router where to find the ISP gateway, and sets the default route through the wan port (I had to learn how to use the same commands in the ADSL2MUE!)

    Which corrects the route table for my setup

    On the WRT54GS
    Code:
    # route
    
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    89.241.aaa.bbb  *               255.255.255.255 UH    0      0        0 vlan1
    192.168.1.0     *               255.255.255.0   U     0      0        0 br0
    127.0.0.0       *               255.0.0.0       U     0      0        0 lo
    default         *               0.0.0.0         U     0      0        0 vlan1
    Before I added them both the vlan1 routes were missing

    On the ADSL2MUE
    Code:
    /var/tmp # route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    89.241.aaa.bbb  *               255.255.255.255 UH    0      0        0 ppp0
    89.241.xxx.yyy  *               255.255.255.255 UH    0      0        0 br0
    192.168.100.0   *               255.255.255.0   U     0      0        0 br0
    239.0.0.0       *               255.0.0.0       U     1      0        0 br0
    default         *               0.0.0.0         U     0      0        0 ppp0
    which allows me to post here and all seems well, till my DSL retrains and I get given new IP and GW.

    I will now try to patch the problem in the modem by spoofing the netmask so the IP address and gateway are in the same network. I don't want to add custom firewall commands in Thibor as I want it to be plug and play between cable and dsl modems

    which works with the router correctly setting a valid default route

    WRT54GS route table now

    Code:
    # route
    
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.1.0     *               255.255.255.0   U     0      0        0 br0
    89.241.0.0      *               255.255.0.0     U     0      0        0 vlan1
    127.0.0.0       *               255.0.0.0       U     0      0        0 lo
    default         89.241.aaa.bbb  0.0.0.0         UG    0      0        0 vlan1
     
  6. mstombs

    mstombs Network Guru Member

    I think I can - the following seems to do the trick for me, and cleans up after itself using a temp file to store the old gateway used.

    Code:
    GWF="/tmp/pppHBGW"
    if [ -r "$GWF" ]; then
      pppHBGW=$(cat "$GWF")
      if [ -n "$pppHBGW" ]; then
        if [ -n "$(route |grep vlan1)" ]; then
          route del -host $pppHBGW dev vlan1
          route del default gw $pppHBGW
        fi
      fi
    fi
    GW=$(nvram get wan_gateway)
    if [ "$GW" != "0.0.0.0" ]; then
      route add -host $GW dev vlan1
      route add default gw $GW
      echo $GW >$GWF
    else rm $GWF
    fi
    I changed above default route command to match what router normally does - easier to explicitly delete on change and avoids duplicates which break things.

    Works for me switching dsl to cable and back, and pulling phone line out and replacing. Switching from cable to dsl I have to manually release/renew Ip lease (or power cycle) because cable lease is 7 days and Router not as clever as Windows XP, it doesn't notice WAN cable being pulled out and replaced!

    Update: DD-WRT v24-sp1 (07/27/08) mega - build 10012 also needs this same firewall script.

    Update: Same script also works for Tomato :- http://www.linksysinfo.org/forums/showthread.php?t=53162 but needs enhancement for dual wan option with variable wan interface name

    Code:
    logger Executing Firewall Script
    GWF="/tmp/pppHBGW"
    IF=$(nvram get wan_iface)
    if [ -r "$GWF" ]; then
      pppHBGW=$(cat "$GWF")
      if [ -n "$pppHBGW" ]; then
        if [ -n "$(route |grep $IF)" ]; then
          route del -host $pppHBGW dev $IF
          route del default gw $pppHBGW
        fi
      fi
    fi
    GW=$(nvram get wan_gateway)
    if [ "$GW" != "0.0.0.0" ]; then
      route add -host $GW dev $IF
      route add default gw $GW
      echo $GW >$GWF
    else rm $GWF
    fi
     

Share This Page