In this tutorial we will learn how to make Ubuntu disable a specific network adapter automatically at system startup for both wired and wireless connections. This will be useful when having multiple network adapters and want to use only one of them.
Let's first see the installed network adapters by running this command from the terminal:

ifconfig

By default, the first wired network adapter will be named eth0, the second eth1 and so on, whereas the wireless network adapter is named wlan0, the second wlan1 and so on.

To disable temporarily a wired or wireless network adapter, you can use one of these commands:

- Wired:

sudo ifconfig eth0 down

- Wireless:

sudo ifconfig wlan0 down

Replace eth0 & wlan0 with your own network adapter names. To re-enable them, use these commands:

sudo ifconfig eth0 up
orsudo ifconfig wlan0 up

To disable these network interfaces automatically at Ubuntu startup, you need to do the following:

- Open the terminal and edit /etc/rc.local with this command:

sudo gedit /etc/rc.local

- Insert now the command for stopping the network interface just before the "exit 0" line:

- Save your file and reboot. Your wired or wireless network adapter will now shut down at system startup.