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

BUG: Unable to connect to modem IP if WAN down

Discussion in 'Tomato Firmware' started by Kevin Darbyshire-Bryant, Jun 24, 2013.

  1. Kevin Darbyshire-Bryant

    Kevin Darbyshire-Bryant Networkin' Nut Member

    Please can someone fix this bug:

    Tested with Toastman or Shibby. When using the 'Route Modem IP' option to be able to connect to an ADSL/VDSL modem connected to WAN port, I'm unable to connect to the modem (ping it even) *IF* the WAN interface has never successfully connected. It looks like vlan2 doesn't get a modem subnet IP address unless the WAN is brought up.

    WAN type is either DHCP or PPPoE.

    Thanks.
     
  2. Elfew

    Elfew Network Guru Member

    Can you debug it, or just test it with Victek latest beta? I cannot confirm it, but I will test it later... no time now, I go sleep
     
  3. M_ars

    M_ars Network Guru Member

    can confirm that problem/bug. But this behaviour has been around for a while... donĀ“t know if it ever worked "right". If WAN is up, everything is working :)
     
  4. szpunk

    szpunk Addicted to LI Member

    Confirm that bug too. And this behaviour has been around for a while...
     
  5. mstombs

    mstombs Network Guru Member

    I don't have this bug with tomato and dhcp- because modems operate in a half-bridge type mode, when they are not connected they still connect to router with a local IP/ short lease.
     
  6. Kevin Darbyshire-Bryant

    Kevin Darbyshire-Bryant Networkin' Nut Member

    My modem operates in full bridge mode, encapsulating Ethernet frames in RFC1483(IIRC) AAL5. It maintains a fixed IP address for configuration via a web interface for which it doesn't forward those frames. Tomato says 'Route Modem IP' which is great. Unfortunately it is dependent upon Tomato's WAN connection being established. If it's not established then I can't communicate with the modem, to fix what may be a configuration issue (Encapsulation Style (VCMUX/LLC) & VCI for example) which is preventing me from getting a WAN connection....see catch 22 :)
     
  7. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    This still seems to be a problem with tomato...
    Im using the latest shibby version for my N66u (140.k26.usb.vpn64k) with pppoe and route modem ip option.
    If the wan goes down and i try a reconnect and it fails i loose access to my modem gui. :(
    Modem: 192.168.254.254
    N66u: 192.168.1.1

    wan up:
    wan-up.png

    wandown:
    wan-down.png

    Has anyone figured out how to fix this ?
    Is there any workaround ?
     
  8. Sean B.

    Sean B. LI Guru Member

    Think about it for a second. If your WAN goes down you lose connectivity to the modem, which is connected via your... WAN port. If the interface of which provides the route out of the WAN port goes down it will take your modem connectivity with it. This is not a Tomato bug, it's a fact of routing. PPPoE is a connection within a connection, and it's the one that carries your routed packets. When that connection drops so does the ppp0 interface, which has the route to your modem. You could add the route to the vlan2 interface manually when the PPPoE connection dies and see if that works. If so, automation with a custom script would be a possibility.
     
    Last edited: Nov 14, 2017
  9. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    I tought there might be an option for a second virtual wan which survives the static route to my modem even if pppoe fails to reconnect.
    No idea how to realise this with a custom script, if i restart the the router i can access my modem even if pppoe doesnt connect so i guess it must be possible...
     
  10. Monk E. Boy

    Monk E. Boy Network Guru Member

    You would need to have two IPs assigned to your WAN port, one for normal internet connectivity, another static solely for connecting to the modem. Remember to block traffic being routed out the static IP, especially if the other IP is down. And be sure to never route traffic out the static IP if the other IP is down... probably not defining a gateway for that IP would do it. And you want one of the interfaces to use PPPoE...

    But how to do this under Tomato? Hell if I know. Remember, Tomato's OS isn't Linux, it's Linux-like. In Linux it's not all that complicated:
    https://www.ostechnix.com/how-to-assign-multiple-ip-addresses-to-single-network-card-in-linux/

    There's probably a reason this problem is still outstanding.
     
  11. Sean B.

    Sean B. LI Guru Member

    When you reboot, and prior to the ppp0 interface making a connection, the route to your modem is likely on the vlan2 interface as it would be with a non-pppoe connection. Once ppp0 becomes active the routing table is changed, and probably doesn't change back when the connection dies because it has to remain in order for pppoe reconnect attempts to be tried/work.
     
  12. Sean B.

    Sean B. LI Guru Member

    @Holy_Hunter , when your connection dies and the WAN goes down have you tried simply bringing vlan2 back up? If not, give it a try.. GUI - Tools->System Commands and run this:

    Code:
    ifconfig vlan2 up
     
  13. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

  14. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    Code:
    ifconfig vlan2 up
    Doesnt help, only a reboot does work but only for a short time until the interface goes down again because of the non working pppoe connection.
     
  15. Sean B.

    Sean B. LI Guru Member

    When you say "wan goes down" and you cannot access the modem, does the Status page show that the PPPoE connection is gone? Or is connectivity gone yet the Status page still shows a connection? IE: Which button is clickable.. connect or disconnect on the status page?

    Another thing to try when modem access is lost is:

    Code:
    service firewall restart
    If that does no good, also try:

    Code:
    service wan restart
     
  16. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    The Status page will show "Disconnected" first, than hangs on "Status -- Connecting" and the connect Button is clickable.
    Clicking the "Connect" button doesnt work when the dsl connection is down, which ofc makes sense.
    Btw, a "manual Disconnect" on the Status page also shuts down the route to my modem.

    Than i've recognized something... When pppoe goes down the modem access is still avalible for a few seconds.
    I think the route to my modem goes down when the pppoe deamon is connecting and than stays down if its not successfull.

    Sadly "Service wan and service Firewall restart" does not work either. (DSL down)

    And i went back to shibby 132 because QoS wasnt working as it should with 140.
    But it doesnt make a diffrence with the modem problem.
     
  17. Sean B.

    Sean B. LI Guru Member

    Unfortunately, troubleshooting this issue without having a PPPoE connection to recreate and test on makes it a bit of a shot in the dark process. While PPPoE is connected and the modem is accessible run this:

    Code:
    ip route show
    And post the output. Mainly looking to see if there's a configured source IP for the route, if so it will be needed for my next suggestion which is to add the route manually when the modem becomes unreachable:

    1. Run ifconfig and verify the vlan2 interface is still up. If it's listed in the output then it is, however if it's not then run "ifconfig vlan2 up".

    2. Add the route manually by running:

    Code:
    ip route add 192.168.254.254/32 proto static dev vlan2
    If, however, when "ip route show" was run prior to connectivity loss it had a source IP configured for the route then add that to the command. Example:

    Code:
    ip route add 192.168.254.254/32 proto static src 1.2.3.4 dev vlan2
    Providing the route added without error or issue, attempt accessing the modem and see if there's any change in connectivity.
     
  18. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    Thanks for your help Sean B.! :)

    Code:
    root@N66U-Tomato1:/tmp/home/root# ip route show
    xx.xx.xx.WAN-GW dev ppp0  proto kernel  scope link  src xx.xx.xx.WAN-IP
    192.168.254.254 dev vlan2  proto kernel  scope link  src 192.168.254.253
    192.168.55.0/24 dev br1  proto kernel  scope link  src 192.168.55.1
    192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.1
    127.0.0.0/8 dev lo  scope link
    default via xx.xx.xx.WAN-GW dev ppp0

    Code:
    vlan2      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx
               UP BROADCAST RUNNING  MTU:1500  Metric:1
               RX packets:148 errors:0 dropped:0 overruns:0 frame:0
               TX packets:153 errors:0 dropped:0 overruns:0 carrier:0
               collisions:0 txqueuelen:0
               RX bytes:37992 (37.1 KiB)  TX bytes:36545 (35.6 KiB)
    

    Code:
    root@N66U-Tomato1:/tmp/home/root# ip route add 192.168.254.254/32 proto static dev vlan2

    Code:
    root@N66U-Tomato1:/tmp/home/root# ip route add 192.168.254.254/32 proto static sr
    c 1.2.3.4 dev vlan2
    RTNETLINK answers: No such device

    If run "ifconfig vlan2 up" together with "ip route add 192.168.254.254/32 proto static dev vlan2" when pppoe is down and i can see vlan 2 and the ip adress of my modem in the routing table but i couldnt access or ping the modem...
    Code:
    root@N66U-Tomato1:/tmp/home/root# route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    192.168.254.254 *               255.255.255.255 UH    0      0        0 vlan2
    192.168.55.0    *               255.255.255.0   U     0      0        0 br1
    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
    

    However if i run:
    Code:
    root@N66U-Tomato1:/tmp/home/root# ifconfig `nvram get wan_ifname`:0 192.168.254.253
    ...after i get access to the modem even with disconnected pppoe!

    Routing looks like this now (with pppoe connection):
    Code:
    root@N66U-Tomato1:/tmp/home/root# ip route show
    xx.xx.xx.WAN-GW dev ppp0  proto kernel  scope link  src xx.xx.xx.WAN-IP
    192.168.254.254 dev vlan2  proto kernel  scope link  src 192.168.254.253
    192.168.55.0/24 dev br1  proto kernel  scope link  src 192.168.55.1
    192.168.254.0/24 dev vlan2  proto kernel  scope link  src 192.168.254.253
    192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.1
    127.0.0.0/8 dev lo  scope link
    default via xx.xx.xx.WAN-GW dev ppp0
    Now there is a second route to my modem (after pppoe connect)..
    Code:
    192.168.254.254 dev vlan2  proto kernel  scope link  src 192.168.254.253
    +
    192.168.254.0/24 dev vlan2  proto kernel  scope link  src 192.168.254.253
    Is this legit ?
    It seems like that i only need "ifconfig vlan2 up" + "ifconfig `nvram get wan_ifname`:0 192.168.254.253" to get it working with Route Modem IP option enabled...


    So i've tried the following without "Route Modem IP" in the Scripts section...
    Code:
    Init: 
    sleep 5
    ifconfig `nvram get wan_ifname`:0 192.168.254.253
    Code:
    Firewall:
    iptables -t nat -I POSTROUTING -o `nvram get wan_ifname` -d 192.168.254.254 -j MASQUERADE
    
    ...and it does seem to work.
    Now i only need to run "ifconfig vlan2 up" when pppoe is down and i can access my modem just fine. :confused:
     
  19. Sean B.

    Sean B. LI Guru Member

    Nice job. That wan ifname part is a catch of the PPPoE interface, and why the route wouldn't add to vlan2 for you as it would for me. One thing to possibly add to the solution would be to write a script for use in Scheduler. One that would check connectivity independently, and upon a failed check automatically bring vlan2 back up. Scheduler can run the check at whatever interval you want. If that may be useful I can assist with the scripting, if needed.
     
  20. Holy_Hunter

    Holy_Hunter Networkin' Nut Member

    That sounds good !
    I'll see how far i can get with the script, havent done this before...
     

Share This Page