An administrator wants to configure a virtual IP address on interface eth0 with IP 192.168.1.100/24. Which command correctly adds the virtual IP as an alias?
Trap 1: ip addr add 192.168.1.100/24 dev eth0 alias eth0:0
Incorrect: The ip command does not support an 'alias' keyword; the alias is defined by the device name (e.g., eth0:0).
Trap 2: ip addr add 192.168.1.100/24 dev eth0 label eth0:0
Incorrect: The 'label' parameter only sets a descriptive label for the address; the device remains eth0, so the IP is not assigned to eth0:0.
Trap 3: ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0
Incorrect: ifconfig is deprecated and not available on all modern distributions; the ip command is the standard tool. Although the syntax is valid, the question expects the iproute2 approach.
- A
ip addr add 192.168.1.100/24 dev eth0 alias eth0:0
Why wrong: Incorrect: The ip command does not support an 'alias' keyword; the alias is defined by the device name (e.g., eth0:0).
- B
ip addr add 192.168.1.100/24 dev eth0:0
Correct: The ip addr add command with dev eth0:0 assigns the IP directly to the virtual interface alias, which is the standard iproute2 method.
- C
ip addr add 192.168.1.100/24 dev eth0 label eth0:0
Why wrong: Incorrect: The 'label' parameter only sets a descriptive label for the address; the device remains eth0, so the IP is not assigned to eth0:0.
- D
ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0
Why wrong: Incorrect: ifconfig is deprecated and not available on all modern distributions; the ip command is the standard tool. Although the syntax is valid, the question expects the iproute2 approach.