ubuntu 服务器:wifi

ubuntu 服务器:wifi

我刚刚在既有有线网络端口又有 wifi 卡的计算机上安装了 Ubuntu 14.04 服务器。如果无法使用有线网络,我希望服务器使用有线网络;如果无法使用 wifi,我希望服务器使用 wifi。

原始的 /etc/network/interfaces 如下所示:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto p4p1
iface p4p1 inet dhcp

我跟着发布并修改我的文件如下:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet dhcp
wpa-ssid <my_ssid>
wpa-psk <my_ssid_password>

# The primary network interface
auto p4p1
iface p4p1 inet dhcp

当我重新启动 wlan0 时,我可以连接到我的 wifi,没有问题。如果我在插入网线的情况下重新启动计算机,也不会出现问题,因为有线和 wifi 连接都连接到我的网络。但是,如果我拔下有线连接并重新启动,我会在启动时看到消息“正在开始配置网络设备”。然后,在系统完全启动之前,我会看到消息“等待最多 60 秒进行网络配置”(因此它等待网络 120 多秒)。当计算机启动时,我的 wifi 连接已连接。

所以,我想一切都正常了,但我的无头服务器需要很长时间才能完全启动。我做错了什么?有没有办法解决这个启动延迟问题?谢谢。

答案1

声明“auto p4p1”和“auto wlan0”要求系统自动启动两个都接口。当您在以太网分离的情况下启动并要求接口启动时,系统会出错:“等待最多 60 秒进行网络配置。”

省略“auto”声明将会更加有效,但肯定不是自动的:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#auto wlan0
iface wlan0 inet dhcp
wpa-ssid <my_ssid>
wpa-psk <my_ssid_password>

# The primary network interface
#auto p4p1
iface p4p1 inet dhcp

并根据需要手动启动任一界面:

sudo ifup -v wlan0

相关内容