OpenWRT - how to do initial login (ssh) if 192.168.1.1 can't be routed?

10,000

You should be able to configure your local (windows) network card so that you can talk to the router over wired ethernet. Most likely the DHCP server and packet routing services of the router are not operating, but I'm guessing the LAN port is.

Configure Static IP Address on Windows 10 PC

First, make sure you are physically connected (ethernet cable) from your win10 machine to one of the router's LAN ports.

On windows 10, hit WIN+R, then type in ncpa.cpl and hit ENTER.

Find the wired network interface you are using from the list in the new window that opens. Right click it, and select Properties.

In the new window, look for the field labeled Internet Procotol Version 4 (TCP/IPv4), Left click it, then click the Properties button below.

Select Use the following IP Address, and fill in the fields as shown:

IP Address: 192.168.1.2
Subnet Mask: 255.255.255.0
Default Gateway: 192.168.1.1

Preferred DNS Server: 192.168.1.1

Click OK to each confirmation window to close them all. You should have ethernet connectivity to your router now. Note that you won't have internet access until the router is properly configured; just a point to point connection to the router. Once the router is working, you will want to change these settings back to Obtain an IP address automatically and Obtain DNS server address automatically.

If you still can't connect to the router, try to ping it at 192.168.1.1, run ipconfig from a command prompt, and update your answer with the results of both (ping and ipconfig).

As a side note, if you aren't particularly experienced with Linux or networking, I'd suggest using the web interface to configure your router (http://192.168.1.1 and use the username 'admin' instead of 'root'. As you get more familiar with openWRT, you will likely find there are some advanced things that you may need to do from the command line that the web UI doesn't support. But in general running as root on a Linux box (even a router) when you are trying to figure out what you are doing usually does not end well.

Share:
10,000

Related videos on Youtube

Eric
Author by

Eric

SQL is my jam

Updated on September 18, 2022

Comments

  • Eric
    Eric over 1 year

    I also posted on the OpenWRT forum about this issue. I'll copy the text of the problem verbatim, below, but here's a summary.


    Another edit - my LAN/WAN jack LEDs are not lit up while attempting to access in normal mode, but in failsafe mode they are. Not sure if this is typical or not.


    After flashing my EA4500 with a trunk build (which seems to be the only supported way to get OpenWRT on this device), I have no way to ssh into the router without using failsafe mode. Now all the configuration I have done is written to the failsafe partition (I think). Is there a way to force Windows to allow me to ssh over the ethernet cable without network access? Do I need a console cable/serial cable/another router? I would like to start over and do this correctly.


    From OP:

    I think my failsafe and normal partitions have somehow been kajigerred. I've been Googling and reading docs for a few hours, I need to go to sleep so I'm going to drop my question here and hope someone can help. I apologize if I'm making a silly mistake.

    Background - I am brand new to OpenWRT. I have some limited networking experience, a little Linux knowledge (I can get around and do basic things easily), I like to tinker. I am a Windows guy though so a lot of this is beyond my depth.

    I installed OpenWRT on my EA4500 following the Wiki here: https://wiki.openwrt.org/toh/linksys/ea … ecommended.

    This was straightforward, it didn't take the firmware the first time but on the second time, it flashed and rebooted.

    This is where the problems began.

    I had already read that I would need to set a root password before being able to do much else. I was not able to access the router via ssh nor telnet. I used putty, pointed it at 192.168.1.1, nothing. Tried setting the username to root, nothing. Every time, I get "No route to host". With telnet, there is a similar error, but I don't remember what it was. Windows will not let anything use the ethernet adapter because it thinks it's not connected. I don't have a console cable or a serial cable to try and dig deeper with this, but that should be unnecessary anyways, unless I'm missing something very basic in the docs. So I read more and found the failsafe mode, which works perfectly. I may have made a mistake here. I got logged in via ssh, set the root password, and ran mount_root. Then I installed LuCI from the shell following this guide: https://wiki.openwrt.org/doc/howto/luci.essentials; I ran everything up to and including the 'uhttpd enable' command. Then I installed some other packages, and configured wifi and some other various settings. Then I thought to myself, you idiot, you're still in failsafe mode. So I rebooted just to see what would happen, of course, it was the same as last time, no way to get into the router. So once again I booted to failsafe mode, except now all my configuration from before has remained. I took a backup of this config. I then ssh'd in again, installed sftp server, and used WinSCP to grab the contents of /etc/config/ and /overlay/upper/etc/config/. I compared a hash of these files and they are all identical from /etc/ to /overlay/upper/etc/ - but this is all in failsafe mode - and I don't know if that's a problem.

    I have an idea of what I've done - I've done all my configuration on the failsafe partition instead of the "overlay" partition, or user partition, or whatever it's called. Still learning here!

    Anyways, I don't know what I need to do to swap this around so that I can reboot my router and not have a gimped version of OpenWRT. I'm also concerned there may be security issues with running in failsafe mode 24/7. I am more than happy to give the contents of any files if it helps figure out what's going on here. I'm on Windows 10, have Putty, telnet, WinSCP, etc.

    I also have a Raspberry Pi I could possibly use to configure the router from, if it's going to be vastly easier to do from Linux.

    Thanks and again, sorry if this is a common problem or I've made a stupid mistake - I've searched and come up with nothing. Also interested to know how one would ssh into a router via IP (for the initial setup) if the router isn't routing... does one need a second router to do this, or console cable, or ... ?


    Edit: Tried setting the static IP per the answer below, it did not work. Here is some diagnostic info for starters:

    Pinging 192.168.1.1 with 32 bytes of data:
    PING: transmit failed. General failure. 
    PING: transmit failed. General failure. 
    PING: transmit failed. General failure. 
    PING: transmit failed. General failure. 
    
    Ping statistics for 192.168.1.1:
        Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
    
    Windows IP Configuration
    
       Host Name . . . . . . . . . . . . : Office
       Primary Dns Suffix  . . . . . . . : 
       Node Type . . . . . . . . . . . . : Hybrid
       IP Routing Enabled. . . . . . . . : No
       WINS Proxy Enabled. . . . . . . . : No
    
    Ethernet adapter Ethernet 2:
    
       Connection-specific DNS Suffix  . : 
       Description . . . . . . . . . . . : SonicWALL Virtual NIC
       Physical Address. . . . . . . . . : 00-60-73-79-58-67
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::8812:cecd:2ce7:b263%4(Preferred) 
       Default Gateway . . . . . . . . . : 
       DHCPv6 IAID . . . . . . . . . . . : 50356339
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1E-55-36-F9-40-8D-5C-72-99-BF
       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    
    Ethernet adapter Ethernet:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . : lan
       Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller
       Physical Address. . . . . . . . . : 40-8D-5C-72-99-BF
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    
    Tunnel adapter isatap.{355E7D48-19B0-4611-88EB-EEAC6761563D}:
    
       Media State . . . . . . . . . . . : Media disconnected
       Connection-specific DNS Suffix  . : 
       Description . . . . . . . . . . . : Microsoft ISATAP Adapter #4
       Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
    
  • Eric
    Eric almost 8 years
    Thank you so much for the detailed answer, I will attempt this shortly. I am comfortable in Linux/Bash, so this won't be a problem. The reason I can't use the web interface is because this router only accepts a trunk build which does not come with a GUI. I've had no problem getting up and running, installing luci etc., but only from the failsafe mode. I'll update shortly.
  • Eric
    Eric almost 8 years
    Also if this is coming from a doc somewhere on openWRT, would you mind linking to it for the sake of your answer? I'm about to give this a go, btw.
  • Argonauts
    Argonauts almost 8 years
    It isn't from a specific document; it's a general process to set a static IP in windows.
  • Eric
    Eric almost 8 years
    That did not work unfortunately. I'm going to keep playing around with it - I think we're on the right track here. I did try with the Sonicwall VNIC disabled after generating this log, I hadn't realized that was still running. I'll have to paste the output into my question so I don't surpass the character limit here.
  • Argonauts
    Argonauts almost 8 years
    The issue is that you have no link at all - meaning physical level carrier detect - with the router on your NIC, so the assumption that at least the LAN interface on the router was working was incorrect. Assuming you have it wired properly, it appears that your router is close to (if not completely) bricked.
  • Eric
    Eric almost 8 years
    ... it works fine when I drop it back into failsafe mode though... it's been running like that all day in fact.
  • Eric
    Eric almost 8 years
    I think I am going to restore to stock and reflash later tonight.
  • Eric
    Eric almost 8 years
    I also read something about this particular model overheating when flashing, causing similar behavior - perhaps something similar is occurring when it attempts to build the filesystem during normal boot? I have no clue.
  • Argonauts
    Argonauts almost 8 years
    the fact that it works in failsafe means that your configuration is in some way causing the boot to fail on the router - failsafe mode uses hard coded basic configuration settings and doesn't use any changes you may have made. Starting fresh might be the best choice. What version EA4500? v1, v2 v3?
  • Eric
    Eric almost 8 years
    That's not correct in my case. When I boot failsafe mode, all my configuration is saved - Luci is installed, my SSIDs and passwords are correct, my root password is the same, time zone settings, all of it - these changes were made in failsafe mode because it has not been possible to make any changes in normal mode, since it won't boot correctly, it seems. Additionally the contents of /overlay/upper/etc/config/* match the contents of /etc/config/* exactly, in failsafe mode, both before and after running mount_root, which seems to do nothing. This is the EA4500 v1 (Cisco branded, 12A106 SN)
  • Eric
    Eric almost 8 years
    This is extremely strange. So, I forced a failed boot 3x in a row, and instead of reverting to the stock firmware, it reverted to OpenWRT, except now it works fine. It's as if somehow the partitions were mixed up before. I am afraid to reboot now, though, because I don't know what is on the recovery partition, and I don't know if I'm in normal mode or failsafe mode.
  • Eric
    Eric almost 8 years
    IT WORKED. I have no idea what has happened here. I don't even want to call this an answer because it's really just an even larger question. Something went cray cray with filesystem and forcing a recovery has made it right again.