My setup is that I have two raspberry Pis connected directly via ethernet (enxb827eb9c0ecf), let's call them Pi 1 and Pi 2. Pi 1 is also connected wirelessly to my home router. I would like to be able to send a file from Pi 2 to Pi 1 over ethernet and then upload that file online using the WiFi on Pi 1.
I am trying to connect to the internet over wlan0 on Pi 1, but Pi 1 seems to prioritize attempting to connect to the internet via ethernet (where I am not connected to the web but to Pi 2). I am running Raspbian Stretch (so all the tutorials saying to edit /etc/network/interfaces are outdated according to this guide).
I have deleted /etc/ifplugd/action.d/action_wpa so that WiFi on Pi 1 connects fine but it seems to prioritize using the eth0 connection when reaching out to the web. (I can ping both Pis back and forth totally fine)
Note that all the following configurations and details are for Pi 1
/etc/dhcpcd.conf
interface wlan0
static ip_address=192.168.2.143/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
interface enxb827eb9c0ecf
static ip_address=192.168.3.142/24
/etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=CA
network={
ssid="********"
psk="********"
key_mgmt=WPA-PSK
}
ifconfig
enxb827eb9c0ecf: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.142 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::96ca:62e8:edea:e3e3 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:9c:0e:cf txqueuelen 1000 (Ethernet)
RX packets 594 bytes 37223 (36.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 590 bytes 27674 (27.0 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 385 bytes 36222 (35.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 385 bytes 36222 (35.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.143 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::df3f:baa8:e17c:aef4 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:c9:5b:9a txqueuelen 1000 (Ethernet)
RX packets 1147 bytes 118792 (116.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 667 bytes 102957 (100.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
iwconfig
lo no wireless extensions.
wlan0 IEEE 802.11 ESSID:"******"
Mode:Managed Frequency:2.437 GHz Access Point: 40:C7:29:4E:4D:FE
Bit Rate=72.2 Mb/s Tx-Power=31 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=70/70 Signal level=-28 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
enxb827eb9c0ecf no wireless extensions.
cat /etc/resolv.conf
# Generated by resolvconf
nameserver 192.168.2.1
cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d
ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enxb827eb9c0ecf: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
pfifo_fast state UP mode DEFAULT group default qlen 1000
link/ether b8:27:eb:9c:0e:cf brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
mode DORMANT group default qlen 1000
link/ether b8:27:eb:c9:5b:9a brd ff:ff:ff:ff:ff:ff
ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enxb827eb9c0ecf: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
group default qlen 1000
link/ether b8:27:eb:9c:0e:cf brd ff:ff:ff:ff:ff:ff
inet 192.168.3.142/24 brd 192.168.3.255 scope global enxb827eb9c0ecf
valid_lft forever preferred_lft forever
inet6 fe80::96ca:62e8:edea:e3e3/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
group default qlen 1000
link/ether b8:27:eb:c9:5b:9a brd ff:ff:ff:ff:ff:ff
inet 192.168.2.143/24 brd 192.168.2.255 scope global wlan0
valid_lft forever preferred_lft forever
inet6 fe80::df3f:baa8:e17c:aef4/64 scope link
valid_lft forever preferred_lft forever
ip route show
default via 192.168.2.1 dev wlan0 src 192.168.2.143 metric 303
192.168.2.0/24 dev wlan0 proto kernel scope link src 192.168.2.143 metric 303
192.168.3.0/24 dev enxb827eb9c0ecf proto kernel scope link src 192.168.3.142 metric 202
`interface wlan0
static ip_address=192.168.2.143/24
static routers=192.168.2.1
static domain_name_servers=192.168.2.1
interface enxb827eb9c0ecf
static ip_address=192.168.3.142/24`
and on Pi 2 /etc/dhcpcd.conf says the following:
`interface eth0
static ip_address=192.168.3.151/24`
I rebooted both Pis and still can't connect to the internet on Pi 1
– Matt Jul 04 '18 at 22:48ip link show
ip addr show
ip route show
– eftshift0 Jul 04 '18 at 22:50