How to disable a VirtualBox network interface using a command-line?

Thierry Marianne picture Thierry Marianne · Jun 3, 2014 · Viewed 16.9k times · Source

When list virtual network interfaces, some of them are not anymore needed:

vboxnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:01 
vboxnet8: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:08 
vboxnet9: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:09 
vboxnet11: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:0b 
vboxnet12: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether 0a:00:27:00:00:0c 

How can I make them disable them for good?

Answer

Thierry Marianne picture Thierry Marianne · Jun 3, 2014

It turns out VirtualBox comes natively with a special command dedicated to this need:

e.g. to remove the network interface vboxnet0, execute the following command

VBoxManage hostonlyif remove vboxnet0