手机版

ubuntu网络配置

时间:2020-03-30 来源:互联网 编辑:宝哥软件园 浏览:

一、dhcp自动获取IP

编辑/etc/network/interfaces

auto lo                                       # 开机自动激lo接口
iface lo inet loopback                        # 配置lo接口为环回口
# The primary network interface (配置主网络接口)
auto eth0                                     #开机自动激活eth0接口
iface eth0 inet dhcp                          #配置eth0接口为DHCP自动获取

重启网络:

sudo /etc/init.d/networking restart

二、配置静态IP

编辑/etc/network/interfaces

# The loopback network interface(配置环回口)
  auto lo                                       # 开机自动激lo接口
  iface lo inet loopback                        # 配置lo接口为环回口
  # The primary network interface (配置主网络接口)
  auto eth0                                     #开机自动激活eth0接口
  iface eth0 inet static                        #配置eth0接口为静态设置IP地址
  address 10.16.3.99
  netmask 255.255.255.0
  gateway 10.16.3.1

重启网络:

sudo /etc/init.d/networking restart

版权声明:ubuntu网络配置是由宝哥软件园云端程序自动收集整理而来。如果本文侵犯了你的权益,请联系本站底部QQ或者邮箱删除。

相关文章推荐