LX0-104 · Question #671
When issuing the command ifconfig eth0 192.168.1.20/24 up, which of the following happens? (Choose two correct answers.)
The correct answer is A. The address 192.168.1.20 is associated with the interface eth0. B. A network route to 192.168.1.0 with the netmask 255.255.255.0 pointing directly to eth0 is. The ifconfig command with an IP address and CIDR suffix on an interface assigns the specified address and automatically configures a direct route for the corresponding local network.
Question
Options
- AThe address 192.168.1.20 is associated with the interface eth0.
- BA network route to 192.168.1.0 with the netmask 255.255.255.0 pointing directly to eth0 is
- C192.168.1.1 is probed for router functionality and, in case of success, it is added to the list of
- DThe addresses from 192.168.1.20 to 192.168.1.24 are activated on the interface eth0.
- EIf eth0 was configured with a previous IP address, it is retained an addition to adding the new
How the community answered
(36 responses)- A78% (28)
- C6% (2)
- D3% (1)
- E14% (5)
Why each option
The `ifconfig` command with an IP address and CIDR suffix on an interface assigns the specified address and automatically configures a direct route for the corresponding local network.
The command `ifconfig eth0 192.168.1.20/24 up` explicitly assigns the IPv4 address `192.168.1.20` to the `eth0` network interface.
When an IP address and subnet mask (implied by /24) are assigned to an interface, the operating system automatically creates a connected route for the local subnet (`192.168.1.0/24` with netmask `255.255.255.0`) that is directly accessible via the `eth0` interface.
Assigning an IP address with `ifconfig` does not automatically probe for or add default router functionality; default gateway configuration is a separate routing step.
The `/24` in `192.168.1.20/24` is a CIDR notation for the subnet mask (255.255.255.0), not a range of IP addresses to be activated.
When `ifconfig` is used to set an IP address, it typically replaces any previously configured primary IP address on that interface unless specific commands or flags for adding a secondary address are used.
Concept tested: ifconfig IP address assignment
Source: https://www.man7.org/linux/man-pages/man8/ifconfig.8.html
Topics
Community Discussion
No community discussion yet for this question.