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

posted on 2018-01-21 23:46  SKTone  阅读(306)  评论(0编辑  收藏  举报

导航