Ubuntu 配置ip地址

自己在玩Ubuntu的时候连接Xshell,但是Ubuntu的ens33没有显示IP地址,如下图:

配置步骤:

 1、修改配置文件  

sudo vim /etc/network/interfaces

添加:

 auto eth0
 iface eth0 inet static
 address 192.168.0.111  #配置没有被使用的ip地址
 netmask 255.255.255.0
 gateway 192.168.0.252 #写入网关地址
 dns-nameservers 1.1.1.1 #写dns解析地址

网关地址可以通过命令查看 :

ip route

都配置好之后可以通过如下命令重启服务

 /etc/init.d/networking restart

我是通过重启系统的。系统启动成功后,输入 ifconfig 

xshell就可以通过上述ip连接。

原文地址:https://www.cnblogs.com/gun-a/p/11409750.html