Wednesday, February 22, 2017

How to disable and enable ethernet on Ubuntu


If you are using ethernet cable for your network connection and you want to disable it without unplug the cable, you can do it from the command line.

Ubuntu has specific command dedicated for this type of situation, with this command you can disable and enable any network interfaces that you have including ethernet (usually eth0).

First you want to run 'ifconfig' command to see which network interface you want to disable, let's say the ethernet is eth0 and you want to disable it, so you run this:
sudo ip link set down eth0
You can run 'ifconfig' and see the eth0 should be gone, if you want to enable eth0 again, you can do this:
sudo ip link set up eth0
Using the command above, you can enable and disable any network interface basically, not just eth0, it could be eth1, eth2, wlan0, wlan1, etc.
sudo ip link set [up/down] [network-interface]

No comments:

Post a Comment