由于某种原因,需要使用Linux Server 操作系统。由于Centos server用了几年了,所以就换种口味用用Ubuntu server 15.10 。但是重装系统之后,使用
ifconfig
之后才发现,系统网络接口中只有lo 127.0.0.1的本地迂回地址,然而网线接口和WIFI接口网卡都没有。。
第一反应=》重装系统=》然而还没有
第二反应=》装系统的时候插网线=》网线接口有了,WIFI没有
第三反应=》装系统的时候插网线,且启用WIFI=》然而都没有了
第四反应=》容我仔细考虑一下
OK,装系统的时候可以搜索的WIFI,且有线接口可以工作,那就说明系统支持驱动了噻。于是问问谷哥大侠,结果就有了答案。
一、查看本地Network硬件信息
sudo lshw -C network
如下:
*-network description: Ethernet interface product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:01:00.0 logical name: enp1s0 version: 06 serial: 00:e0:66:c9:c6:9e size: 100Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=100.71.131.96 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s resources: irq:88 ioport:e000(size=256) memory:d0704000-d0704fff memory:d0700000-d0703fff *-network description: Wireless interface product: Centrino Wireless-N 135 vendor: Intel Corporation physical id: 0 bus info: pci@0000:03:00.0 logical name: ap0 version: c4 serial: 0c:d2:92:ae:29:fb width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=4.2.0-16-generic firmware=18.168.6.1 ip=192.168.12.1 latency=0 link=yes multicast=yes wireless=IEEE 802.11bgn resources: irq:92 memory:d0600000-d0601fff *-network DISABLED description: Wireless interface physical id: 1 bus info: pci@0000:03:00.0 logical name: wlp3s0 serial: 0c:d2:92:ae:29:fa capabilities: ethernet physical wireless configuration: broadcast=yes driver=iwlwifi driverversion=4.2.0-16-generic firmware=18.168.6.1 link=no multicast=yes wireless=IEEE 802.11bgn
如上可知,有线网卡设备名叫“enp1s0” ,无线网卡设备名叫“wlp3s0”
二、配置interface
sudo vim /etc/network/interfaces
加入:
# The primary network interface auto enp1s0 iface enp1s0 inet dhcp # This is an autoconfigured IPv6 interface iface enp1s0 inet6 auto auto wlp3s0 iface wlp3s0 inet dhcp iface wlp3s0 inet6 auto
三、重启电脑
ifconfig
看看,是不是添加的网卡出来了呢?
四、无关的后记
博主启用WIFI网卡的原因在于创建WIFI热点。但是我发现,上述配置之后,使用create_ap 创建WIFI热点时,系统会阻塞两分钟,于是重新编辑/etc/network/interface之后,就觉得快多了。
编辑后如下:
# 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 # The primary network interface auto enp1s0 #iface enp1s0 inet dhcp iface enp1s0 inet dhcp # This is an autoconfigured IPv6 interface iface enp1s0 inet6 auto #auto wlp3s0 #iface wlp3s0 inet auto #iface wlp3s0 inet6 auto
Tip: 其实就是注释掉了WIFI网卡接口而已。