ubuntu 16.04 server版网络配置

配置有线网络

sudo vi /etc/network/interfaces
添加网络配置:

    auto eth_name
    iface eth_name inet dhcp

网络的名字可以这样获取:

$ ifconfig -a

然后重启网络服务:

$ sudo /etc/init.d/networking restart

配置无线网络

首先可能需要配置国内的网络源:

$ sudo vi /etc/apt/sources.list

屏蔽cdrom,添加
deb http://mirrors.aliyun.com/ubuntu/ xenial main
(16.04代号为xenial)

安装wpasupplicant(在连接有线情况下):

$ sudo apt-get install wpasupplicant

然后进入/etc/network/interfaces,继续添加无线配置:


    auto wlan0
    iface wlan0 inet dhcp
    wpa-ssid MY_WIFI
    wpa-psk MY_WIFI_PASSWORD

然后重启即可。

网络配置例子


    # This file describes the network interfaces available on your system

    # and how to activate them. For more information, see interfaces(5).

    source /etc/network/interfaces.d/*

    # The loopback network interface

    auto lo
    iface lo inet loopback

    auto wlan0
    iface wlan0 inet dhcp
    wpa-ssid MY_WIFI
    wpa-psk MY_WIFI_PASSWORD

    auto eth0
    iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.1

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容