1.修改 /etc/network/interfaces 文件
格式如下(建议增量添加):
# 静态ip
auto wlp7s0
# wlp7s0 是网卡名称
iface wlp7s0 inet static
# 设置 DHCP 为动态
address 192.168.123.102
# 要设置的静态 IP 地址
netmask 255.255.255.0
# 子网掩码
gateway 192.168.123.1
# 网关
dns-nameserver 192.168.123.1
# dns 地址
#-----下方添加其他IP地址------
auto wlp7s0
iface wlp7s0 inet static
address 192.168.123.200
netmask 255.255.255.0
auto wlp7s0
iface wlp7s0 inet static
address 192.168.123.201
netmask 255.255.255.0
auto wlp7s0
iface wlp7s0 inet static
address 192.168.123.202
netmask 255.255.255.0
2.添加完毕后输入下方命令重启网络
systemctl restart networking
PS:如果遇到报错,输入 systemctl status networking 查看