ubuntu设置静态ip

ubuntu设置静态ip

修改网络配置文件

sudo vim /etc/network/interfaces

修改为如下内容,其中enp9s0是网卡的名字,若是配置完静态ip后无法解析服务器,则需要添加最后的dns-nameserver,这样子重启后就会在/etc/resov.conf文件中添加一行nameserver

#The primary network interface
auto enp9s0
#iface enp9s0 inet dhcp
iface enp9s0 inet static
address 192.168.2.105
netmask 255.255.255.0
gateway 192.168.2.1
dns-nameservers 8.8.8.8

评论

此博客中的热门博文

使用ssh反向代理+shadowsocks实现内网穿透

shadowsocks中转

ubuntu 16.04 reboot命令慢的原因