VM: ifconfig sees the interface but it is not in /etc/network/interfaces

11,503

Seems like you are using NetworkManager. You can find the configuration file here:

/etc/NetworkManager/system-connections/name-of-connection

For a manual configuration of your interface you should have something like below in your /etc/network/interfaces file:

auto eth0
iface eth0 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    gateway 192.168.1.1

Change eth0 to match your interface name. Then add your name server (DNS) entries to /etc/resolv.conf

nameserver XX.XX.XX.XX
(List any others you may have)

Then bring up your interface and restart the networking daemon:

 ifconfig eth0 up
 /etc/init.d/networking restart

If your network interface is up and live but cannot find it in /etc/network/interfaces, have you checked inside this directory?

/etc/network/interfaces.d

The interfaces file sources files from inside there.

Aside from that, you can use the commands:

ifconfig -a
ip addr

to view the current configuration settings for all (-a option is 'all', including interfaces that are down) of your interfaces.

Share:
11,503

Related videos on Youtube

Mario Kamenjak
Author by

Mario Kamenjak

Updated on September 18, 2022

Comments

  • Mario Kamenjak
    Mario Kamenjak over 1 year

    I am running Debian stable in a Virtualbox VM. I have configured the interface via the GUI(and it works as expected). However, I can't see the interfaces now in /etc/network/interfaces. Only the loopback interface is there.

    Where can I see the configurations of the interfaces(other than the GUI)?

  • Mario Kamenjak
    Mario Kamenjak about 7 years
    interfaces.d is empty. ifconfig sees the interfaces, but I would want to see the config files, or whatever I can use to configure the interfaces to use a static ip via CLI.
  • diametralpitch
    diametralpitch about 7 years
    Added more info for you. See my edit above.
  • Mario Kamenjak
    Mario Kamenjak about 7 years
    Oh wait, does it perhaps mean that the configuration in /etc/network/interfaces won't appear by default if I enter it in Network manager? It seems I had the wrong idea on how NM does this. Also yes, I found the network in Network managers folder. Now will it hurt network manager if I configure the same interface in the /etc/network/interfaces as well, with identical addresses?
  • diametralpitch
    diametralpitch about 7 years
    That's right. NM uses its own configuration files and it will not modify /etc/network/interfaces. However, you can allow it to setup interfaces based on what you have in /etc/network/interfaces. Have a look here wiki.debian.org/NetworkManager#Enabling_Interface_Management‌​. I would set up /etc/network/interfaces manually and remove the corresponding entry from NM.