debian绑定多IP以及配置DNS
2018-08-25 / Server / 2222 次围观 / 0 次吐槽 /1、设置IP地址、网关
/etc/network/interfaces #编辑网网卡配置文件
默认配置为:
Bash
auto eth0 #开机自动连接网络
iface lo inet loopback
iface eth0 inet static #static表示使用固定ip,dhcp表述使用动态ip
address 192.168.1.2 #设置ip地址
netmask 255.255.255.0 #设置子网掩码
gateway 192.168.1.1 #设置网关
如果要在eth0上绑定多IP写法为:
Bash
auto eth0:0
iface eth0:0 inet static
address 192.168.1.3
netmask 255.255.255.0
#如果还要继续添加ip,同理再在下面添加eth0:1、eth0:2….
2、设置dns
Bash
vi /etc/resolv.conf #编辑配置文件
nameserver 1.1.1.1 #设置首选dns
nameserver 8.8.8.8 #设置备用dns
3、重启网络
Bash
/etc/init.d/networking restart #重启网络
Powered By Cheug's Blog
Copyright Cheug Rights Reserved.