Ubuntu16.04網絡不能訪問解決辦法
問題:
系統重啟後,網絡不能正常使用,加載網絡配置失敗,且重啟網絡時也提示錯誤。
解決方法:
在定位的過程中發現是配置中的網絡設備號與實際設備號不符。
1、查看網絡配置中的配備號:
vi /etc/network/interfaces |
# 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 enx000ec6d35ea9 iface enx000ec6d35ea9 inet dhcp |
2、在查看實際的設備號:
cat /proc/net/dev |
Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed wlp3s0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 enx000ec6d35ea9: 2009002 11002 0 0 0 0 0 0 28508118 20031 0 0 0 0 0 0 lo: 70781548 42425 0 0 0 0 0 0 70781548 42425 0 0 0 0 0 0 enp0s31f6: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 |
3、進行比對
將配置中的設備號與實際設備號對比,如果沒有則在配置中加入設備號記錄。
比如舉例中我的網卡設備號為“enx000ec6d35ea9”,無線網卡的設備號為“wlp3s0”。
4、配置無線網卡
vi /etc/network/interfaces |
#自動獲取IP方式: auto wlan0 iface wlan0 inet dhcp wpa-ssid xxxxxx wpa-psk yyyyyy |
#配置靜態IP方式 auto wlan0 iface wlan0 inet static address 192.168.0.150 netmask 255.255.255.0 gateway 192.168.0.1 dns-nameservers 192.168.0.1 xxx.xxx.xxx.xxx wpa-ssid xxxxxx wpa-psk yyyyyyy |
Ubuntu16.04網絡不能訪問解決辦法