I have a Raspberry Pi connected via Ethernet to a local LAN that doesn't have internet. This Raspberry has a static IP fixed as 192.168.1.23 since we need each device in this LAN to have an specific IP address
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.23 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::3edf:d0f5:3374:cf74 prefixlen 64 scopeid 0x20<link>
ether e4:5f:01:54:1b:c7 txqueuelen 1000 (Ethernet)
RX packets 230 bytes 20599 (20.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 106 bytes 12776 (12.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Now, I need to connect the Raspberry Pi to internet to install some packages.
I don't want to disconnect it from the LAN or change the IP settings, so what I did is configure the WLAN to connect to our Wifi which does have internet.
The wlan0 has an IP assigned to it, so the connection to wifi is established and correct
However it looks like when trying to access internet it cannot do it (my guess is that since eth0 is connected it tries to reach internet via eth0 instead of wlan0)
How can I tell my raspberry that even if eth0 is connected I want it to use wlan0 when accessing internet?
ifconfig
for the wlan interface and the output ofnetstat -rn
when connected to the Internet to the question. My guess is, that the default gateway is 192.168.1.1. To connect to the Internet, the default gateway should be on the wlan network. You may need some additional static routes for your internal network. – Ljm Dullaart Jan 17 '22 at 21:29ip a && ip r
– Milliways Jan 18 '22 at 00:50