软件——Ubuntu16.04设置静态ip地址

1.获取网卡名称

在命令行输入ifconfig -a

2.修改网卡配置文件

sudo vim /etc/network/interfaces

加上下面的配置,IP地址可以成适合你的

auto eth0              # eth0 替换成之前获取的网卡名称
iface eth0 inet static  
address 192.168.8.160  # 静态IP
netmask 255.255.255.0
gateway 192.168.8.2

3.修改DNS配置

$ sudo vim /etc/resolvconf/resolv.conf.d/head

4.重启网络服务

$ sudo /etc/init.d/networking restart

到此为止就设置好静态IP了.
附:如果你的CRT连接报错The remote system refused the connection.
可能是没有安装ssh 服务,输入下面命令即可
$ sudo apt-get install openssh-server 
posted @ 2020-04-29 10:25  五公子说  阅读(345)  评论(0编辑  收藏  举报