vim /etc/network/interfaceshtml
将如下内容:linux
auto eth0
iface eth0 inet dhcpubuntu
修改成:vim
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx网络
把xxx.xxx.xxx设置为你要个性的信息既可,其中auto eth0
#开机自动链接网络iface eth0 inet static
#static
表示使用固定ip,dhcp
表述使用动态ipaddress
是本机IP地址netmask
子网掩码gateway
网关spa
若是使用nano
编辑的话
ctrl+o #保存配置
ctrl+x #退出rest
linux系统的DNS信息是保存在/etc/resolv.conf , 可是在ubuntu中用vim打开这个文件你会发现有以下文字的提示code
DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
orm
因此不能直接个性这个文件,这个内容可能会被覆盖server
在ubuntu中dns信息是放在/etc/resolvconf/resolv.conf.d/目录下
通常状况下这个目录下有base和head两个文件夹
vim /etc/resolvconf/resolv.conf.d/base
保存后执行
resolvconf -u
用如下命令使网络设置生效
service networking restart
sudo /etc/init.d/networking restart
转载请注明: 飘云