1

闲扯

这里扯一下我遇到的问题,如果没兴趣,直接跳过,看下一个大标题

系统装好后,执行命令:

ifconfig

发现只有网线端口和lo

enp0s25: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:1d:72:84:8f:62  txqueuelen 1000  (Ethernet)
        ...

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        ...

查看硬件

因为我的网卡是PCIE的,执行命令看一下:

lspci
00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (primary) (rev 0c)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 0c)
00:03.0 Communication controller: Intel Corporation Mobile PM965/GM965 MEI Controller (rev 0c)
00:03.2 IDE interface: Intel Corporation Mobile PM965/GM965 PT IDER Controller (rev 0c)
00:03.3 Serial controller: Intel Corporation Mobile PM965/GM965 KT Controller (rev 0c)
00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)
00:1a.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1d.0 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.7 USB controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HEM (ICH8M-E) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801HM/HEM (ICH8M/ICH8M-E) SATA Controller [AHCI mode] (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)
05:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
05:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)
05:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)

能识别到无线网卡

03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)

查看网卡的名字

lshw -C network

很惊奇地发现,网卡驱动是有的,只是被系统禁止使用了,第二个network后面的DISABLED

  *-network                 
       description: Ethernet interface
       product: 82566MM Gigabit Network Connection
       vendor: Intel Corporation
       physical id: 19
       bus info: pci@0000:00:19.0
       logical name: enp0s25
       version: 03
       serial: 00:1d:72:84:8f:62
       capacity: 1Gbit/s
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=e1000e driverversion=3.2.6-k firmware=0.3-0 latency=0 link=no multicast=yes port=twisted pair
       resources: irq:27 memory:fe000000-fe01ffff memory:fe025000-fe025fff ioport:1840(size=32)
  *-network DISABLED
       description: Wireless interface
       product: PRO/Wireless 3945ABG [Golan] Network Connection
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:03:00.0
       logical name: wls3
       version: 02
       serial: 00:1c:bf:42:f7:10
       width: 32 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwl3945 driverversion=4.15.0-96-generic firmware=15.32.2.9 ip=192.168.3.100 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:30 memory:dfcff000-dfcfffff

既然驱动都没有问题,那就把它启用就好了。

解决问题

18.04版本的ubuntu与早期的网络配置不一样,16.04及之前的是改/etc/network/interfaces
18.04的配置文件改变了,改为/etc/netplan/50-cloud-init.yaml

安装软件

我是接着网线装的
sudo apt-get install wpasupplicant
sudo apt-get install network-manager

修改网络配置

sudo vim /etc/netplan/50-cloud-init.yaml

修改内容如下:
注意yaml文件内容的缩进格式,不懂可以谷歌一下

network:
  renderer: NetworkManager
  ethernets:
    enp0s25:
      dhcp4: true
  wifis:
    wls3:
      dhcp4: no
      addresses:
        - 192.168.3.100/24
      gateway4: 192.168.3.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
        search: []
      access-points:
        "301":
          password: '07691234'
  version: 2
wls3是我的网卡名字,也就是命令lshw -C network看到的名字
dhcp4: no不使用自动获取IP
addresses要使用的IP
gateway4路由IP
access-points下面配置的是wifi的ssid和密码

启用无线网

sudo netplan generate
sudo netplan apply

再次执行ifconfig看一下

$ ifconfig
enp0s25: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:1d:72:84:8f:62  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 20  memory 0xfe000000-fe020000  

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 8083  bytes 574680 (574.6 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8083  bytes 574680 (574.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wls3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.3.100  netmask 255.255.255.0  broadcast 192.168.3.255
        inet6 fe80::21c:bfff:fe42:f710  prefixlen 64  scopeid 0x20<link>
        ether 00:1c:bf:42:f7:10  txqueuelen 1000  (Ethernet)
        RX packets 1751  bytes 150643 (150.6 KB)
        RX errors 0  dropped 1026  overruns 0  frame 0
        TX packets 350  bytes 57846 (57.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

使用无线网可以正常连网了


Chiu
312 声望5 粉丝