在笔记本电脑上启动第二个 WiFi

在笔记本电脑上启动第二个 WiFi
  • 我使用标准 Ubuntu 14.04 network-manager

  • 我用第二张卡连接了 Wi-Fi wlan1

我怎样告诉网络管理器让我wlan0自己配置​​我的卡ifconfig

最后我想适应这个脚本,因此它将控制权交给了wlan1网络管理器

答案1

我知道有两种方法可以让网络管理器忽略设备:

/etc/network/interfaces

任何有效的配置都可以。这取决于在 中managed设置为false(或取消设置)/etc/NetworkManager/NetworkManager.conf。从手册页

[ifupdown]
This section contains ifupdown-specific options and thus only has effect
when using ifupdown plugin.

managed=false | true
    Controls whether interfaces listed in the 'interfaces' file are 
    managed by NetworkManager.  If set to true, then interfaces listed 
    in /etc/network/interfaces are managed by NetworkManager.  
    If set to false, then any interface listed in /etc/network/interfaces 
    will be ignored by NetworkManager. Remember that NetworkManager 
    controls the default route, so because the interface is ignored, 
    NetworkManager may assign the default route to some other interface.  
    When the option is missing, false value is taken as default.

因此,您可以添加/etc/network/interfaces类似以下内容:

auto wlan0
iface wlan0 inet manual

将其添加到非托管设备列表

来自手册页:

[keyfile]
This section contains keyfile-specific options and thus only has effect
when using keyfile plugin.
...
unmanaged-devices=mac:<hwaddr>;mac:<hwaddr>;...
    Set devices that should be ignored by NetworkManager when using 
    the keyfile plugin. Devices are specified in the following format: 
    "mac:<hwaddr>", where <hwaddr> is MAC address of the device to be 
    ignored, in hex-digits-and-colons notation. Multiple entries are 
    separated by a semicolon. No spaces are allowed in the value.
    Example:
    unmanaged-devices=mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4

首先查找MAC地址:

ifconfig wlan0 | grep -i HWaddr

在这里,您可以编辑/etc/NetworkManager/NetworkManager.conf。在某个[keyfile]部分下(如果不存在,请添加一个),添加:

unmanaged-devices=mac:some-mac-address

第一种方法取决于ifupdown所使用的插件,第二种方法取决于keyfile所使用的插件。默认情况下,两种方法都使用,并且managedfalse

您需要重新启动网络管理器才能使配置文件的更改生效(感谢@rubo77):

sudo service network-manager restart

相关内容