Tag: wireless interfaces

How to prevent NetworkManager from managing a specific interface? (SOLVED)

NetworkManager is a Linux service that manages various network interfaces, including physical, such as Ethernet and wireless, and virtual, such as VPN and other tunnels. Network Manager can be configured to manage some or all of the system interfaces.

NetworkManager has a graphical interface - this is the applet that opens when you click on the network icon located next to the clock, as well as the network and network settings windows, which you can access from the applet. NetworkManager comes preinstalled on many Linux distributions by default.

While NetworkManager is an excellent service for managing the day-to-day needs of a user's computer, its effects are usually not optimal for a testing environment. NetworkManager can independently, without a user request, change the MAC addresses of network interfaces, as well as change their state - for example, when a USB Wi-Fi adapter is connected, it is NetworkManager that sets it in the up state, it can bring the wireless interface out of monitor mode and switch it to its normal state.

If you want to avoid this for certain network interfaces, then besides the obvious solution to stop the NetworkManager service or remove NetworkManager altogether, there are other options. By the way, if you are just not satisfied with the fact that the MAC addresses are changed to arbitrary, then this can be configured or disabled in the NetworkManager itself.

What is an unmanaged interface in NetworkManager

The unmanaged state in NetworkManager for a network interface means that NetworkManager does not interact with this network interface in any way: it does not enable it, does not change its operating mode, does not change the MAC address, does not use it to scan networks, and does not even show it in the list of network interfaces - that is, NetworkManager pretends that this interface simply does not exist in the system.

How to determine if NetworkManager is managing a specific network interface

The unmanaged state only has an effect on the NetworkManager itself. You, as usual, you can see all network interfaces with the command

ip a

or only wireless interfaces by command:

iw dev

At the same time, it is not indicated in any way whether this interface is controlled by NetworkManager.

As already mentioned, if your device is not in the list of network interfaces shown by NetworkManager, then it may be in an unmanaged state.

But to be sure of this, you can use the nmcli command, which is a command line tool for managing NetworkManager. To display a list of network interfaces and their status, run the command:

nmcli dev status

For unmanaged devices, it will show “unmanaged”.

Suppose I want NetworkManager not to change in any way the settings of the wireless network interface named wlp0s20f0u1.

How to temporarily move a network interface to unmanaged in NetworkManager

The network interface can be disconnected from NetworkManager management temporarily or permanently (so that this status remains after reboot). In fact, you can change the status at any time.

To temporarily make the interface unmanaged, run a command like:

nmcli dev set INTERFACE managed no

For instance:

nmcli dev set wlp0s20f0u1 managed no

We check:

nmcli dev status

Pay attention to the line:

wlp0s20f0u1   wifi      unmanaged  --             

This setting is reset not only after restarting the computer, but also after disconnecting and connecting the network interface (plug and unplug).

How to put network interface to unmanaged in NetworkManager so that this persists after reboot

To prevent NetworkManager from touching the network interface immediately after starting the service and to keep this setting after a reboot, you need to use the keyfile method.

To do this, open the file /etc/NetworkManager/NetworkManager.conf:

sudo gedit /etc/NetworkManager/NetworkManager.conf

And add lines like this there:


You can list any number of MAC addresses.

You can view the MAC addresses of network interfaces with the command

ip a

But remember that NetworkManager could already assign an arbitrary MAC address, to see the real one, run a command like this:

nmcli dev set INTERFACE managed no

List the MAC address of each interface that Network Manager should ignore, separated by semicolons. Make sure the MAC addresses listed here are written in lowercase.

Newer versions of NetworkManager may also use the more general alternative KEYFILE method, which does not include the actual MAC addresses and instead uses the interface names. This syntax replaces the above [keyfile] section with the following:


For example, I want NetworkManager not to manage the wlp0s20f0u1, wlp0s20f0u2 and wlp0s20f0u3 network interfaces, then my lines are as follows:


Save your changes and restart the service:

sudo systemctl restart NetworkManager

Let's check:

nmcli dev status

How to return a network interface under NetworkManager control

Now the listed network interfaces will always be “unmanaged”. But they can be set back under the control of NetworkManager. To do this, simply roll back the changes made in the NetworkManager.conf file and restart the service.

If you took the interface out of the NetworkManager control with the nmcli command, then you can return it to its previous state with the command:

nmcli dev set INTERFACE managed yes

How to turn off NetworkManager

If you want to completely stop NetworkManager so that it stops managing all network interfaces at once, then run the command:

sudo systemctl stop NetworkManager

If you want to remove NetworkManager from startup, then run:

sudo systemctl disable NetworkManager

To start NetworkManager again and add it to startup run:

sudo systemctl start NetworkManager
sudo systemctl enable NetworkManager

Why does VirtualBox lose connection when changing MAC address (SOLVED)

Virtual machine, after changing MAC address of eth0, the connection does not work. When changing only the last three octets, the situation is the same. Restarting the modem does not give results, there is no filtering by MAC addresses. Why is this happening and how can I fix it?

VirtualBox does not support changing the MAC address inside the guest virtual machine.

The “official” method of operation is to change the address in the virtual machine settings when the guest computer is completely turned off.

Guest MAC address information is generated by the physical hardware, in this case the VirtualBox network adapter.

VirtualBox uses the hardware on the host and provides the MAC address for the guest as if it were in metal. But a reasonable question arises, because on a physical computer, the MAC address is also hard-coded into the network card and it is impossible to change it on it, but Linux supports changing the MAC address to arbitrary ones and the network is working fine, why is there such a difference?

And by the way, changing the MAC address in the virtual machine breaks the Internet connection for the wired interface only. For Wi-Fi wireless network interfaces (connected via USB), changing the MAC address does not lead to any problems, they work fine, there is a network connection.

There are two possible reasons for this behavior:

1. Whatever MAC address is hard-coded into the network card, the final decision whether or not to accept a packet is made by the operating system kernel. This is in the case of a physical computer. In the case of a virtual machine, it is up to VirtualBox, which may not be aware of what exactly is happening in the virtual machine and that it has changed its MAC address. Therefore VirtualBox does not know about the new MAC address and does not forward Ethernet frames to it.

2. The differences between wired and wireless networks are obvious: in wireless networks, radio waves propagate freely and every device within reach has access to absolutely all transmitted frames. As for the wired network, the sender sends Ethernet frames to a specific port (in the sense of the device's network port). That is, it is possible that the data is simply not sent by the sender to the new MAC address, since it does not know anything about it.

However, some users wrote that they managed to get the wired interface in the virtual machine to work after changing the MAC address - for this they put it in promiscuous mode. This method did not work for me (the network is still unavailable), but you can try it yourself (replace the eth0 interface name with your own):

sudo macchanger -s eth0 # check the current MAC address
sudo macchanger -r eth0 # change the MAC address to random
sudo ip link set dev eth0 promisc on # put the network interface in promiscuous mode
ping # check if the network is working
# sudo macchanger -p eth0 # return the old MAC address if the network is down

As for the wireless interfaces in the virtual machine, everything works there without the need to switch the network interface to promiscuous mode.

Commands for changing the MAC-address of the Wi-Fi card (replace the wlan0 interface name with your own):

sudo ip link set dev wlan0 down # this is required
sudo macchanger -s wlan0 # check the current MAC address
sudo macchanger -r wlan0 # change the MAC address to random
sudo ip link set dev wlan0 up # this is required
# sudo macchanger -p wlan0 # if needed, return the old MAC address