Ubuntu16.04设定ip

Posted SKTone

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu16.04设定ip相关的知识,希望对你有一定的参考价值。

1.查看网卡名称

命令ifconfig -a查看所有网卡

2.添加网卡,设置为dncp并重启网卡(若不知所处ip段)

网卡文件地址/etc/network/interfaces
重启网卡命令 sudo service networking restart

3.查看ip地址,设置静态ip(防止ip变化)

route -n 查看网关
ifconfig 查看ip地址、子网掩码

修改网卡配置,重启网络服务

配置样例

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto ens33
iface ens33 inet static
address 192.168.6.135
netmass 255.255.255.0
broadcast 192.168.6.255
gateway 192.168.6.2

以上是关于Ubuntu16.04设定ip的主要内容,如果未能解决你的问题,请参考以下文章