我刚刚在台式电脑上全新安装了 Ubuntu 16.04。在安装过程中,自动网络脚本失败,因此我手动配置了它(输入了自己的 IP,输入了子网掩码,输入了默认网关),一切正常。它成功连接并完成安装。
现在安装好了,但我没有获得任何网络连接 - 我甚至无法 ping 网关。我正在使用 wifi,无法使用以太网。enp2s0 上的 ifup/ifdown 没有问题。我尝试使用 DHCP,但 DHCP 挂了,也没有解决问题。我还验证了请求的 IP 地址未在网络上使用。
root@ubuntu:/home/liam# lshw —class network
*—network
description: Ethernet interface
product: RTL8111/8168/8411 PCI Express Gigabit Ethernet
vendor: Realtek Semiconductor Co., Ltd.
physical id: O
bus info: pci@0000:02:00.0
logical name: enp2s0
version: 06
serial: b8:97:5a:32:c1:5f
size: 10Mbit/s
capacity: 1Gbit/s
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress msix vpd bus_master cap_list
configuration: autonegotiation=on broadcast=yes driver:r8169
resources: irq:25 ioport:d000(size=256) memory:f0004000-f000
*-network DISABLED
description: Wireless interface
physical id: 1
bus info: usb@1:2
logical name: wlxec086b1eaf1b
serial: ec:O8:6b:1e:af:1b
capabilities: ethernet physical wireless
configuration: broadcast=yes driver:r8188eu multicast=yes
输出/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 enp2s0
iface enp2s0 inet static
address 192.168.1.200
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package
dns-nameservers 192.168.1.254
wpa-ssid ATT548CA
wpa-psk frank777
#auto enp2s0
#iface enp2s0 inet dhcp
# wpa-ssid ATT548CA
# wpa-psk frank777
编辑:无线信息脚本结果:http://paste.ubuntu.com/24446060/
答案1
首先,您的文件在几个方面存在错误。首先,虽然您说要使用无线,但您的接口 enp2s0 是用于以太网的。无线的正确顺序是:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto wlxec086b1eaf1b
iface wlxec086b1eaf1b inet static
address 192.168.1.200
netmask 255.255.255.0
gateway 192.168.1.254
# dns-* options are implemented by the resolvconf package
dns-nameservers 192.168.1.254 8.8.8.8
wpa-ssid ATT548CA
wpa-psk frank777
接下来重新启动界面:
sudo ifdown wlxec086b1eaf1b && sudo ifup -v wlxec086b1eaf1b
检查您是否已连接:
ping -c3 192.168.1.254
ping -c3 www.ubuntu.com