Debian Linux单网卡设置多ip(配置文件高级配置)

xingyun86 2021-8-31 914

Debian Linux单网卡设置多ip(配置文件高级配置)

初级配置
$sudo vi /etc/network/interfaces
===============================
auto eth0
iface eth0 inet static
address 192.168.1.18
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.102.128.68
dns-search workgroup
# Virtual IP 01
auto eth0:0
iface eth0:0 inet static
address 192.168.0.19
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.102.128.68
dns-search workgroup
===============================
高级配置
$sudo vi /etc/network/interfaces
===============================
source-directory /etc/network/interfaces.d
===============================
$sudo vi /etc/network/interaces.d/myip
===============================
auto eth0
iface eth0 inet static
address 192.168.1.18
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.102.128.68
dns-search workgroup
# Virtual IP 01
auto eth0:0
iface eth0:0 inet static
address 192.168.0.19
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 202.102.128.68
dns-search workgroup
===============================

立即生效模式:

$sudo /etc/init.d/networking restart

×
打赏作者
最新回复 (0)
查看全部
全部楼主
返回