On a Debian system using the traditional ifupdown scheme, which stanza in /etc/network/interfaces brings up eth0 at boot with an address obtained from a DHCP server?
LPIC-1 Exam 102-500, objective 109. Networking fundamentals medium
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Not correct auto eth0 iface eth0 inet static
Wrong. The `static` method requires you to supply address, netmask and gateway lines yourself; it never contacts a DHCP server.
Not correct auto eth0 iface eth0 inet loopback
Wrong. The `loopback` method exists for the lo interface only and configures 127.0.0.1.
Not correct allow-hotplug eth0 iface eth0 dhcp
Wrong as written. interfaces(5) defines the stanza as `iface <name> <address_family> <method>`, so the family keyword is required: it has to read `iface eth0 inet dhcp`. (allow-hotplug itself is a valid keyword and means bring the interface up when the kernel reports the device appearing.)
Correct auto eth0 iface eth0 inet dhcp
Correct. `auto eth0` marks the interface to be started by `ifup -a` at boot, and `iface eth0 inet dhcp` selects the IPv4 family with the DHCP method, so a client obtains the address, mask, gateway and DNS servers from the server.
Why
The stanza syntax is `iface IFACE FAMILY METHOD`, where the family is inet (IPv4) or inet6 (IPv6) and common methods are static, dhcp, loopback and manual. `auto` starts the interface during boot; `allow-hotplug` starts it when the device appears. Static stanzas add indented `address`, `netmask` (or CIDR in the address) and `gateway` options. Apply changes with ifup and ifdown. Red Hat family systems instead use /etc/sysconfig/network-scripts/ifcfg-* or NetworkManager keyfiles, so this file is Debian-specific.
Where this comes from
- Cited
- LPI exam objective 109.2
- What it says
- Configure a network interface persistently on Debian-style systems.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 109 and space the ones you get wrong.