0

Changes under /etc/network/interfaces are not considered.

This is set :

auto eth0
iface eth0 inet static
address 192.168.202.131
netmask 255.255.255.0
gateway 192.168.202.2
dns-nameservers 8.8.8.8

But after reboot, if I do ifconfig, I still have the old ens33 :

ens33     Link encap:Ethernet  HWaddr 00:0c:29:f9:a7:4a
      inet addr:192.168.93.135  Bcast:192.168.93.255  Mask:255.255.255.0
      inet6 addr: fe80::90ab:97d4:31ea:245a/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:214 errors:0 dropped:0 overruns:0 frame:0
      TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000 
      RX bytes:21403 (21.4 KB)  TX bytes:13645 (13.6 KB)

Why is that ?

trogne
  • 174

1 Answers1

4

It does that because the /etc/network/interfaces file is only for editing current interfaces. You cannot create a new interface or rename an interface from it.

The correct settings that your gonna wanna use is this:

auto ens33
iface ens33 inet static
address 192.168.202.131 
netmask 255.255.255.0
gateway 192.168.202.2 
dns-nameservers 8.8.8.8

The name of the interface being configured in this case is ens33. You can get that information form your ifconfig command. The ens33 on the left of the readout is the name of your interface. This could be eth0, wl0, ens33, etc... The name itself is dynamic and is different for different interfaces (each interface has to be unique, E.g. eth0, eth1 for Ethernet ports 1 and 2). In later versions of Ubuntu the naming schema changed, now eth0, etc... is a fall back if it cannot reliably name an interface.


links:

If you want to rename your interface, checkout this link: https://askubuntu.com/a/689143/180773 (warning, advanced)


Tl;Dr:

The interface name is incorrect for your interfaces file.

Elliot Huffman
  • 797
  • 1
  • 5
  • 16