linux笔记2-配置静态ip

修改文件

/etc/network/interfaces

#eth0是网卡 通过ifconfig status查看

auto eth0

iface eth0 inet static

address 192.168.1.151

netmask 255.255.255.0

gateway 192.168.1.1

要是配置生效,需要重启网卡:

ifconfig eth0 down

ifconfig eth0 up

重启网络

/etc/init.d/networking restart

二、配置dns服务器

3、执行

sudo vim /etc/resolvconf/resolv.conf.d/base

加入nameserver为你的DNS即可

nameserver 192.168.1.1

你可能感兴趣的:(linux笔记2-配置静态ip)