Raspberry Pi Asked by Logan Kuykendall on October 5, 2021
So, here’s how it goes. I have an old Linksys router which I have my raspberry pi connected to via Ethernet. I SSH to it via my laptop or phone by connecting to my router via WiFi. I want to be able to use the WiFi chip on the Pi to connect to a nearby router which is connected to the internet so that I can download packages or whatever I may need on the pi while at the same time using the Ethernet connection to my offline router so I can SSH to it.
Here is the output of ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::c2:b104:6cc3:b0fe prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:99:7f:6e txqueuelen 1000 (Ethernet)
RX packets 110 bytes 10715 (10.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 865 bytes 74304 (72.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.103 netmask 255.255.254.0 broadcast 192.168.1.255
inet6 fe80::9076:675d:2f7:651a prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:cc:2a:3b txqueuelen 1000 (Ethernet)
RX packets 5795 bytes 1276439 (1.2 MiB)
RX errors 0 dropped 75 overruns 0 frame 0
TX packets 33 bytes 5412 (5.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
When I run
iw wlan0 link
I get this
Connected to 50:60:28:40:c9:b1 (on wlan0)
SSID: whcc
freq: 5745
RX: 2041558 bytes (7502 packets)
TX: 4884 bytes (33 packets)
signal: -52 dBm
tx bitrate: 162.0 MBit/s
bss flags:
dtim period: 1
beacon int: 100
So to me it looks like I should be connected to the internet, so I test that with a ping
ping -c 5 www.google.com
And I get
ping: www.google.com: Temporary failure in name resolution
Here’s the output of
ip route
default via 192.168.1.1 dev eth0 src 192.168.1.100 metric 202
default via 192.168.0kernel.1 dev wlan0 src 192.168.0.103 metric 303
192.168.0.0/23 dev wlan0 proto scope link src 192.168.0.103 metric 303
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100 metric 202
So I’m not sure what the next step is, because the internet isn’t working even though it says it’s connected to the WiFi.
If you need more info let me know!
I'm noticing your WiFi has a /23 netmask but your wired network uses /24.
Is there a compelling reason why you used a /23 netmask on one of the networks. They should probably both agree (and probably should be /24).
The reason for this is that the network stack uses the netmask to determine if a remote host is on the same subnet vs. a different subnet (in which case it will need to send packets to a router to forward to the remote host). But with your particular network numbers and masks, it will end up getting confused into thinking they are not he same subnet ... when in reality they are not.
Your network configuration is unclear (and possibly unnecessarily complicated). I suspect you may be able to simplify he setup. WiFi and wired clients can be mixed on the same subnet ... and I'm wondering if you thought they needed to be separated.
Basically one of your computers thinks both machines are on the same subnet. The other machine thinks they are both on different subnets.
Answered by Tim Campbell on October 5, 2021
You still haven't explained how you set up networking, but you have 2 default routes, and the Ethernet has higher priority.
As Ethernet isn't connected to internet you can disable this by adding the following at the bottom of :- /etc/dhcpcd.conf
interface eth0
nogateway
Ideally you should properly configure the router to not advertise.
Answered by Milliways on October 5, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP