I have installed the latest OpenWrt firmware on a Raspberry Pi 4, and now I am struggling to configure the network settings.
I am aware that the default IP address of the Raspberry Pi running OpenWrt is 192.168.1.1, but the issue is I cannot SSH into it if I connect it to the router because my default gateway IP (Router IP) is also 192.168.1.1
Even though changing the IP of the router and then SSH into Raspberry Pi via 192.168.1.1 is a solution, I am looking into a different solution where I can set a different static IP address for the Raspberry Pi by doing any sort of configuration to the files inside the SD card that I insert into the Raspberry Pi.
Do not connect the Pi to your main network at first.
To use the Pi as a LAN device you need to change its IP address to one that is within the network you're going to connect to, but not already in use.
Also very important you need to turn off the DHCP server which OpenWrt has set up by default, both IPv4 and IPv6.
This is straightforward to do by booting the Pi not connected to anything but the PC, then ssh in to 192.168.1.1. Make the changes and reboot and connect to your network.
If you're using the ext4 build you can mount the root filesystem on another Linux PC and edit the files /etc/config/network and etc/config/dhcp. These are on the second partition of the card, which is ext4 format which is a type of filesystem that Windows does not recognize.
What you 'see' is only the boot partition, where the kernel and initrd (initial ramdisk, used to start-up the system) resides.
First step : setup your Windows host with a static ip address with something in the range 192.168.1.2-254 (192.168.1.1 already in use by PI)
Then you can access the GUI web interface
Technically you can use an ssh connection with a terminal client like putty but you need to know the linux command line... not the simplest way
PING 192.168.1.1MUST give a response, if DOESN'T something goes wrong, doublecheck and try again
Second step : change Raspberry ip address from 192.168.1.1 to something unused on your LAN Third step : disable DHCP server on the PI ethernet connection (to avoid conflict with the router)
Fourth step : remove static ip address from your Windows host and use dhcp again
@frollic My RPI is booted and tried to attach to a monitor and it works fine that way.
Then I changed the IP address of the Raspberry Pi to 192.168.1.3, while disabling the DHCP server as well. After that, I connected the Raspberry Pi to my router and was able to SSH into it.
Thank you for your response.
@Fleur thank you for your explanation. I think I cannot directly connect my Raspberry Pi to computer via Ethernet because of two possible reasons:
Raspberry Pi looking into DHCP server at first and it's unable to connect to one (maybe PC have to be on same subnet as Raspberry Pi as @frollic mentioned before)
Using Straight through cable for the connection. Crossover cable might solve the issue (just an assumption)
Hi @lakshanthad, glad to know you solved your problem.
If your PI is v.4 or your PC has a gigabit ethernet port you don't need to use a crossover cable (the PHY ethernet layer of this device can swap the Rx / Tx signal so you don't have to use a crossover cable anymore).
Strange behavior, however, usually a micro LAN (1 cable, two ethernet ports) simply solves the connection problems (in your configuration, where a peer also offers as a DHCP server, you don't even need to temporarily configure a fixed IP on your Windows host, just wait for PI to finish its bootstrap before plugging in the Ethernet cable).
At the cost of sounding repetitive, please remember that ping is your best friend!
So first check to do is ever: ping 192.168.1.1