The legacy command `ifconfig eth0 192.168.1.10 netmask 255.255.255.0` assigns an address to an interface. Which iproute2 command does the same job?
LPIC-1 Exam 102-500, objective 109. Networking fundamentals medium
Machine-checked — no person has signed for it. This question was read against the source cited below by an automated pass, which found no contradiction. That is a weaker claim than it sounds: the same kind of process wrote the question, so it can confirm its own mistake.
Treat it as a good draft rather than as settled fact, and read the source below before you rely on it. It is not used in mock exams here — only questions a person has signed for are.
How these questions are written — where each question comes from, what the verification ledger records, and what happens when one is found wrong.
The options
Not correct ip link set eth0 192.168.1.10/24
Wrong. `ip link` manages layer-2 properties of the device: up/down state, MTU, MAC address, name. It cannot assign an IP address.
Not correct ip route add 192.168.1.10/24 dev eth0
Wrong. `ip route add` inserts a routing table entry telling the kernel how to reach a destination network. It does not give the interface an address.
Not correct ip addr show eth0 192.168.1.10/24
Wrong. `ip addr show` is read-only; it displays addresses. The subcommand that modifies is `add` (or `del`).
Correct ip addr add 192.168.1.10/24 dev eth0
Correct. `ip addr add ADDRESS/PREFIX dev IFACE` attaches the address to the interface. Note that iproute2 expects CIDR prefix notation rather than a separate netmask keyword.
Why
iproute2 splits what ifconfig did into objects: `ip addr` for addresses, `ip link` for the device itself, `ip route` for routing, `ip neigh` for the ARP/neighbour cache. Unlike ifconfig, `ip addr add` adds an address rather than replacing the existing one, so an interface can hold several; remove one with `ip addr del`. Addresses set this way are not persistent across reboots.
Where this comes from
- Cited
- manual page ip-address(8)
Practise this
Reading one question is not practice. The trainer will draw a short set from objective 109 and space the ones you get wrong.
More questions on this objective
- A subnet is defined as 192.168.10.0/26. How many addresses in it can actually be assigned to hosts? machine-checked
- A host is configured with the address 172.20.35.77/20. What is the network address of its subnet? machine-checked
- In IPv6, which address is the loopback address, equivalent in role to 127.0.0.1 in IPv4? machine-checked
- Which is the correct fully compressed form of the IPv6 address 2001:0db8:0000:0000:0000:ff00:0042:8329? machine-checked
- Which pairing of a service with its default port number is correct? machine-checked
- DNS normally uses UDP port 53. In which situation does a DNS client or server fall back to TCP on port 53? machine-checked