dnif-archive / DigiVigi

GNU General Public License v3.0
1 stars 7 forks source link

Ubuntu 16.04 - Network Device Not Managed #12

Closed PRASHANT-SAWANT closed 6 years ago

PRASHANT-SAWANT commented 6 years ago

Hi, Please help me out with this issue. Stuck with this for a very long time now. It is stopping me from working any further.

Environment: Windows -> VBox -> Ubuntu -> A Docker Container

Issue Arised When: Did a requests.post(....) from my Ubuntu IP to it self [IP(A) -> IP(A)]. Soo... what happens is, my network manager says, device is not managed. Cannot connect to internet. Cannot ping my self.

One time fix: Changed - managed=false to true in NetworkManager.conf But the it did not work out much.

Seems like my networking utilities are confused as to who is my DNS or its getting confused as to which network config to follow. (Although i did only one config. But the network manager did some overwriting for me or something when i did that post request)

Any solutions? Anyone stumbled across this?

PRASHANT-SAWANT commented 6 years ago

Here's my current solution. Not sure if this is a temporary fix or permanent one.

  1. NetworkManager.conf file should have dns=dnsmasq uncommented
  2. NetworkManager.conf file should have managed=false
  3. Remove everything from interfaces except auto lo and iface lo inet loopback lines. Make sure there are no extra spaces in this file or any config file named from hereon.
  4. Run this command - $sudo service networking restart

O/P: You'll connect to the internet. IP will be dynamic. Network Manager will take care.

Now to make IP Static and make internet connection work again:

  1. Edit the interfaces file. Learn how to make your IP static by editing your /etc/network/interfaces here Put the static IP, mask, gateway, dns-nameservers <-(this one's very important, it'll make your nameservers static for Network Manager to work with)

  2. You'll again face the error - Network Device Not Managed.

  3. Run following commands: $sudo nano /etc/NetworkManager/NetworkManager.conf Edit this file by, commenting dns=dnsmasq line(this will not revert your dns to be 127.0.1.1 in some cases. 127.0.1.1 is like a local domain name server by default) and changing managed=true.

$sudo service networking restart (to bind the static IP and other configurations to your NIC. This won't make your internet go running) $sudo service network-manager restart (For changes in NetworkManager.conf to take place) $sudo service networking restart (To make sure both interfaces changes and Network Manager are in SYNC)

  1. To check if your nameservers still persist $cat /etc/resolv.conf (You will find your nameservers from interfaces file here) Your file under /etc/dnsmasq.d/ which is network-manager, should contain only this line -> bind-interfaces

P.S: This is just work around that worked for me. There are better solutions which also depend on the version of Ubuntu you're using. Like for example - Ubuntu 17._ has different way to deal with.