What is the command to add another IP address to an interface that already has (at least) one IP address?

A.

ifconfig eth0:1 192.168.1.2

B.

ifconfig eth0 192.168.1.2

C.

ipconfig eth0:1 192.168.1.2

D.

ipconfig eth0 192.168.1.2

E.

ifconfig eth0:sub1 192.168.1.2

题解

「ifconfig」指令可以设置网络界面。「ipconfig」是 Windows 操作系统的指令。

选项 A,正确答案。在网络界面后面接上冒号和别名,就是由该网络界面产生出来的虚拟网络界面。

选项 B,错误答案。根据题目要求,应在同一个网络界面上产生多个虚拟网络界面来设置不同的 IP 地址。

选项 C,没有「ipconfig」指令。

选项 D,没有「ipconfig」指令。

选项 E,正确答案。理由同选项 A,别名不一定要使用数字。虽然题目没有注明要选择两个答案,但选项 A 和选项 E 的指令都可以替网络界面增加 IP 地址。