debian网卡IP设置

下面是个例子:

修改 /etc/network/interfaces

最好先备份一下

cp /etc/network/interfaces /etc/network/interfacesbackup

iface eth0 inet static

address 192.168.0.16

netmask 255.255.255.0

gateway 192.168.0.1

/etc/resolv.conf里面设置DNS服务器,

nameserver 192.168.0.1

#因为我这里网关就是DNS服务器所以是相同的

最后reboot或者#/etc/init.d/networking restart


 

自己的一点做法:

原来我的机器是用dhcp动态指定IP的,那么是这样写的

iface eth0 inet dhcp

我把原来的ineterfaces 拷贝成 interfaces.dhcp

通过上面的修改,拷贝interfaces为interfaces.static

发表评论

您的邮箱地址不会被公开。