3

Lately I have been having to switch between a wifi and wired internet connection with some frequency, and have found that the only way I am capable of doing this is to restart the computer. Here are the two cases of how this works:

1) Start computer with wireless automatically connected. This makes it impossible to later switch to an ethernet connection, even with wifi turned off.

2) Start computer with wifi hardware disabled and ethernet plugged in. This allows an ethernet connection, but if I unplug it and enable wifi, I cannot get a connection.

How would I go about resolving this issue?

Here are the contents of my /etc/network/interfaces file

 # This file describes the network interfaces available on your system
 # and how to activate them. For more information, see interfaces(5).

 source /etc/network/interfaces.d/*

 # The loopback network interface
 auto lo
 iface lo inet loopback

 # The primary network interface
 allow-hotplug eth0
 iface eth0 inet dhcp

Edit: I have found a work-around script, but no solution so far.

 /etc/init.d/networking stop
 nano #this is where i unplug wire and enable wifi, or vice versa, then Ctrl-x
 /etc/init.d/networking start
  • Which flavour of Debian? What manages your network interfaces? – Chris Davies Jan 19 '17 at 17:15
  • Its Debian Jessie (8.7), and I'm not sure if this is answering your question, but the /etc/network/interfaces file helps to manage them, I think. Here is its contents.

    # This file describes the network interfaces available on your system

    and how to activate them. For more information, see interfaces(5).

    source /etc/network/interfaces.d/*

    The loopback network interface

    auto lo iface lo inet loopback

    The primary network interface

    allow-hotplug eth0 iface eth0 inet dhcp

    – Carl Shiles Jan 19 '17 at 17:46
  • Could you clarify what you're doing to try to switch them? Also, do you know if you're using NetworkManager or not? – derobert Jan 19 '17 at 17:50
  • @CarlShiles also, take a look at http://unix.stackexchange.com/help/formatting for how to format your question. Or use the buttons up above the text box. – derobert Jan 19 '17 at 17:52
  • derobert, I was simply going to Settings and then Network, but only wireless connections were listed. – Carl Shiles Jan 19 '17 at 20:27

2 Answers2

4

Your problem lies in the fact that you're using two different things to manage your interfaces. NetworkManager (which is the usual default connection manager on Debian) does not manage any interfaces whose names are listed in /etc/network/interfaces by default.

Either comment out the lines about eth0 in /etc/network/interfaces and have NetworkManager handle both connections or (a bit more involved), move the management of your wireless connection to /etc/network/interfaces.

Joseph R.
  • 39,549
1

I had a similar issue (interfaces do not reconnect after restarting networking), and found the answer here (on Server Fault). I had to change allow-hotplug to auto. I have no idea why it works.

This answer from the Unix & Linux also explicitly mentions having to manually enable the interface if using allow-hotplug instead of auto.

I'm on Debian 10 (Buster) server which doesn't seem to come with NetworkManager.

aiwl
  • 11