-3

I have deep problems with my LAN adapter configuration, using Debian 9.5, so I'll describe what's happened then raise my question.

--First Step: While installing Debian 9.5, I gave the address I wanted to give to my Lan adapter (no DHCP) : 192.168.58.168 with netmask, network, broadcast and gateway: After installation, I first tried ip a to check the network parameters, and noticed that my LAN adapter was called "ens33":

   2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN group default qlen 1000
    link/ether 00:0c:29:3a:e1:17 brd ff:ff:ff:ff:ff:ff

    inet 192.168.58.168/24 brd 192.168.58.255 scope global ens33
       valid_lft forever preferred_lft forever

    inet6 fe80::20c:29ff:fe24:2134/64 scope link
       valid_lft forever preferred_lft forever

Then I edited /etc/resolv.conf to add my 2 DNS and after that, the LAN worked perfectly well: I could ping all machines on my LAN and browse the web through Firefox.

Still, the docs I owned told me that the adapters were defined in the file

/etc/network/interfaces

But when I displayed it with cat, I was surprised to notice that the "ens33" interface didn't appear in that file, though I could ping it and though I could see it through ip a . This looked strange to me...

--Second step: Then after I've added a certain number of packages through apt-get install, including resolvconf and samba, I was satisfied to see that in Dolphin, all the machines of my Windows Domain LAN were visible, and I could even access to the shared directories of my Windows file server and play musical or video files with VLC: Great!

--Third step: Then I restarted the PC, and nothing works any more: I don't have any LAN access, and if I type ip a to see my LAN definitions, I can see that the "ens33" adapter has lost its properties:

ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:0c:29:3a:e1:17 brd ff:ff:ff:ff:ff:ff

So I added the ens33 section to the file /etc/network/interfaces
Now this file is as follows:

'# The loopback network interface
auto lo
iface lo inet loopback
auto ens33
iface ens33 inet static
  address 192.168.58.168
  netmask 255.255.255.0
  network 192.168.58.0
  broadcast 192.168.58.255
  gateway 192.168.58.11
iface dns-nameservers 192.168.58.11 192.168.58.21

As you can see, resolvconf added the 2 DNS I had defined in the file

/etc/resolvconf/resolv.conf.d/base

because when I added them in the resolv.conf file, they were automatically erased since I had installed resolvconf...

But it didn't solve the problem, even after reboot: So, I tried:

ifup ens33

But the system answered:

ifup: /etc/network/interfaces:16: unknown or no address type and no inherits keyword specified
ifup: couldn't read interfaces file "/etc/network/interfaces"

This "couldn't read interfaces file" is quite incomprehensible to me, because if I type:

cat /etc/network/interfaces

it displays just what I reported above.

So, it seems that the "interfaces" file has no real power because:

1: In the beginning, ens33 didn't appear in that file, and still the network was fully operational

2: When I add the interface's definitions in that file, it has no effect on the machine

So I would like to know: Which Linux file(s) really fundamentally define(s) the LAN adapter's parameters ???

  • 4
    Nearly all distributions have switched to using systemd and NetworkManager. This includes Debian... You should be able to see the network settings using the systemctl status NetworkManager command... there's also a commandline configuration tool nmcli ... using the commandline tool, nmcli con should show all the available network connections. In order to use the /etc/network/interfaces setup, you may need to disable NetworkManager. – RubberStamp Oct 14 '18 at 19:45
  • 3
    Could I ask for a more pertinent title? – Jeff Schaller Oct 14 '18 at 20:37
  • Well, the title is justified in my eyes by the fact that, being new to Linux, I'm astounded that the simple configuration of a LAN card, which is not some kind of new and delicate technology, becomes so complicated under Linux meanwhile it's so simple under Windows. I repeat the various questions I raised here: – user1238012 Oct 15 '18 at 5:12
  • 1: Why the interfaces file didn't mention my ens33 interface though it was fully operational? – user1238012 Oct 15 '18 at 5:13
  • 2: Why "resolvconf" does prevent to use "resolv.conf" and force to use "base" and writes itself the DNS properties in "interfaces", and someone tells me here it shouldn't be written that way? – user1238012 Oct 15 '18 at 5:14
2

The iface keyword introduces a network configuration section. You have put your DNS Servers definition on an iface line rather then in the preceding section. This has upset ifup because it doesn't understand the object line starting iface dns-namservers.

If you're going to use the interfaces file at all here is what your configuration might look like

auto ens33
iface ens33 inet static
    address 192.168.58.168
    netmask 255.255.255.0
    broadcast 192.168.58.255
    gateway 192.168.58.11
    dns-nameservers 192.168.58.11 192.168.58.21

However, you're probably going to need to disable NetworkManager if you do this as parts of it completely ignore instructions in the interfaces file. Sadly.

  • I have to precise that the line "iface dns-nameservers" hasnot been added by myself, but by "resolvconf" after I installed it: Firstly, i set my DNS in the "resolv.conf" file, but after "resolvconf" was installed, it erased the content of that file, so I put them DNS into the "base" file and "resolvconf" copied them itself into "interfaces". Looks complicated... – user1238012 Oct 14 '18 at 20:08
  • Take them out of the base file and put them in interfaces. Or the other way round. Not both – roaima Oct 14 '18 at 20:22
  • Thanks for your asnwser: I've just removed the "iface" word before "dns-nameservers", then tried "ifup ens33" and it worked. And still I'm sure it's "resolvconf" that added that line: before installing "resolvconf", I had set the DNS with 2 lines in "resolv.conf". Thanks anyway! – user1238012 Oct 15 '18 at 6:51
2

Why the interfaces file didn't mention my ens33 interface though it was fully operational?

Because, as already mentioned in a comment, there is a movement to replace the "traditional" way of using /etc/network/interfaces with the "new" way of using systemd and network manager.

Why "resolvconf" does prevent to use "resolv.conf" and force to use "base" and writes itself the DNS properties in "interfaces", and someone tells me here it shouldn't be written that way?

Not sure if I understand the question correctly, but a long, long time ago, when networks were static and in big organizations, resolv.conf was written by hand, and the DNS server was part of the organizations. That was before Windows even had proper networking (or Novell stuff). Then everybody and his uncle started to have internet at home, with a home router acting as DHCP server, DNS proxy, and the ISP provided the DNS. So an additional layer was added, which automatically generates resolv.conf based on the information provided by DHCP.

Why did the parameters of the "ens33" interface disappear after reboot?

If I understood your description correctly, they didn't disappear.

ifup: /etc/network/interfaces:16: unknown or no address type and no inherits keyword specified

means there was a syntax error in the file, and

ifup: couldn't read interfaces file "/etc/network/interfaces"

means that because of the error, it couldn't read the information in the file (of course it can read the file itself, otherwise it wouldn't complain about an error in line 16).

Which, in the end, are the effective files that define the properties of a LAN adapter?

That totally depends on whether you run the new system or the traditional system. (Personally, I don't like the new system, so I can't answer that; and even the traditional system has acquired a lot of hooks over time that all may modify the end result. For good reasons, because there are situations where you need it).

A more useful question is: "what files do I need to modify to configure the network correctly for this machine?" And that depends on your network - for the typical home network with a DHCP server in the home router, the answer is "you don't need to modify anything". If you want a concrete answer, please edit the question and describe your network.

To these 4 questions, I've been searching the web and the "man" pages, but couldn't find a single answer.

That's because old stuff on the web (and many man-pages) were written when there only was the "traditional" method, and people writing about the new method often don't mention the old method.

This justifies the title of this page in my opinion, although it seems I've deceived three gurus who, instead of trying to help a beginner, sacrificed a bit of their so precious time to minus my question...

If I may add my personal opinion here: Neutrally phrased questions that keep your personal feelings aside, as well as ideas how "things should be", will have it easier to avoid downvotes.

  • Thank you very much for your clear, exhaustive and friendly answers. They will help me continuing my research and make it clear. Thanks again. – user1238012 Oct 15 '18 at 8:20
  • Doing a bit of previous research also avoids downvotes. See Antix for a Debian without systemd, if you are interested. – Rui F Ribeiro Oct 16 '18 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.