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

rub*_*o77 2 network-manager wireless

  • 我使用标准的 Ubuntu 14.04 和network-manager.

  • 我用我的第二wlan1张卡连接到 wifi 。

我如何告诉网络管理器让wlan0我自己配置我的卡ifconfig

最后我想改编这个脚本,所以它把控制权留给了wlan1网络管理器

mur*_*uru 5

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

提到它 /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.
Run Code Online (Sandbox Code Playgroud)

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

auto wlan0
iface wlan0 inet manual
Run Code Online (Sandbox Code Playgroud)

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

从联机帮助页:

[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
Run Code Online (Sandbox Code Playgroud)

首先查找MAC地址:

ifconfig wlan0 | grep -i HWaddr
Run Code Online (Sandbox Code Playgroud)

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

unmanaged-devices=mac:some-mac-address
Run Code Online (Sandbox Code Playgroud)

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

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

sudo service network-manager restart
Run Code Online (Sandbox Code Playgroud)