zoukankan      html  css  js  c++  java
  • 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

     

     

     

     

  • 相关阅读:
    java学习笔记—ServletConfig、ServletContext接口(13)
    php中的XML DOM(11)
    php中的XML DOM(10)
    java学习笔记—Servlet技术(11)
    MM-移动类型
    MM-委外业务
    English-商务英文邮件例句100句
    ABAP-表中数据的横向累加
    MM-实际应用中的难题
    ABAP-加密解密
  • 原文地址:https://www.cnblogs.com/gongxr/p/10452083.html
Copyright © 2011-2022 走看看