1

Hey everyone I have an rpi3 model B. Built in wifi works fine and ethernet too. However, I need to be able to plug it into a second network via ethernet but access it via ssh on it's wifi network (different networks altogether). Every time I plug in the ethernet cable I get booted off my SSH tunnel which was connected by wifi. Here is every config file I can think of:

 ifconfig:

 eth0      Link encap:Ethernet  HWaddr b8:27:eb:d9:28:08
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
         RX packets:1994 errors:0 dropped:0 overruns:0 frame:0
         TX packets:37 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000
         RX bytes:127512 (124.5 KiB)  TX bytes:6653 (6.4 KiB)
 lo        Link encap:Local Loopback
      inet addr:127.0.0.1  Mask:255.0.0.0
      inet6 addr: ::1/128 Scope:Host
      UP LOOPBACK RUNNING  MTU:65536  Metric:1
      RX packets:0 errors:0 dropped:0 overruns:0 frame:0
      TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1
      RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
wlan0     Link encap:Ethernet  HWaddr b8:27:eb:8c:7d:5d
      inet addr:172.16.2.124  Bcast:172.16.2.255  Mask:255.255.255.0
      inet6 addr: fe80::fca0:bb02:2506:3409/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:2532 errors:0 dropped:79 overruns:0 frame:0
      TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:484542 (473.1 KiB)  TX bytes:23357 (22.8 KiB)

wpa_supplicant.conf:

country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="CNGuest"
        psk="**********"  obviously not actually asterix
        id_str="internetguest"
}

/etc/network/interfaces

# Include files from /etc/network/interfaces.d: (empty!)
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback


allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


iface eth0 inet manual

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Also worth noting that my default route is set to wlan0. Still eth0 boots it.

Where is this switch taking place and how do I fix it?

Thanks

sbail95
  • 11
  • 3
  • What you have in `interfaces` is wrong, and would never have worked. Calling `dhcp` disables `dhcpcd` which is the daemon which WOULD have allocated IP addresses. See [How do I set up networking/WiFi/Static IP](http://raspberrypi.stackexchange.com/a/37921/8697) – Milliways Oct 26 '16 at 23:01

2 Answers2

2

Try this:

sudo ifplugd eth0 --kill
sudo ifplugd eth0 --check-running

The condensed version:

ifplugd is a "helpful" daemon that automatically reconfigures your network for you when you plug in a cable.

Dale Wilson
  • 121
  • 3
0

If you are running SSH when on wireless, then unplugging wireless and replacing it with wired, it changes the IP address. For example, my Pi ends its (INTERNAL) IP address with 17 on wireless. On wired mine ends with 24. Your computer is losing connection because the IP changed. You want to do ifconfig when it's connected to wired, then SSH again using the IP address that wired ifconfig gave you.

Hope this helps, Dallin

Dallin Wright
  • 81
  • 1
  • 1
  • 9