ubuntu服务器:wifi

我刚刚在我的电脑上安装了Ubuntu 14.04服务器,它有一个有线网络端口和一个wifi卡。 我希望服务器使用有线网络,如果不可用,并在无法使用时使用wifi。

原始的/ etc / network /接口如下所示:

# 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  wpa-psk  # The primary network interface auto p4p1 iface p4p1 inet dhcp 

当我重新启动wlan0时,我能够连接到我的wifi,没问题。 如果我在插入网络电缆的情况下重新启动计算机,则无论是有线连接还是wifi连接都连接到我的网络都没有问题。 但是,如果我拔掉有线连接并重新启动,我会在启动时看到“正在启动配置网络设备”消息。 然后,在系统完全启动之前,我会看到“等待网络配置多达60秒”的消息(因此它等待网络的120多秒)。 当计算机启动时,我的wifi连接已连接。

所以,我觉得事情很有效,但我的无头服务器需要很长时间才能完全启动。 我究竟做错了什么? 反正有没有解决这个启动延迟? 谢谢。

声明’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  wpa-psk  # The primary network interface #auto p4p1 iface p4p1 inet dhcp 

并根据需要手动启动任一接口:

 sudo ifup -v wlan0