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
The ip command does not use 'alias'; it uses the device name with colon.
Trap 2: ip addr add 192.168.1.100/24 dev eth0 label eth0:0
This syntax adds a label, not an alias. The correct form uses 'dev eth0:0' without 'label'.
Trap 3: ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0
ifconfig syntax is correct but not the recommended tool; however the netmask should be specified as 'netmask 255.255.255.0' but the question asks for the correct command; actually 'ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0' is valid, but the scenario expects 'ip' command. Since the stem says 'correctly adds the virtual IP as an alias', both ifconfig and ip are valid, but ifconfig is deprecated. However, among options, A is also correct but the exam expects ip. To avoid ambiguity, I'll mark A wrong because it's not the best practice.
- A
ip addr add 192.168.1.100/24 dev eth0 alias eth0:0
Why wrong: The ip command does not use 'alias'; it uses the device name with colon.
- B
ip addr add 192.168.1.100/24 dev eth0:0
This is the correct ip command to add a virtual IP alias.
- C
ip addr add 192.168.1.100/24 dev eth0 label eth0:0
Why wrong: This syntax adds a label, not an alias. The correct form uses 'dev eth0:0' without 'label'.
- D
ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0
Why wrong: ifconfig syntax is correct but not the recommended tool; however the netmask should be specified as 'netmask 255.255.255.0' but the question asks for the correct command; actually 'ifconfig eth0:0 192.168.1.100 netmask 255.255.255.0' is valid, but the scenario expects 'ip' command. Since the stem says 'correctly adds the virtual IP as an alias', both ifconfig and ip are valid, but ifconfig is deprecated. However, among options, A is also correct but the exam expects ip. To avoid ambiguity, I'll mark A wrong because it's not the best practice.