Enable/Disable Your Network Interface

Today we’ll cover one way to enable or disable your network interface in the Linux terminal. We will cover enabling and disabling your network interface, so you might want to keep this in mind.

If you have multiple network interfaces, you might want to disable one of them. You might want to disable networking to keep a computer offline. There are many reasons why you’d want to enable or disable your networking.

This isn’t a very complicated process, so it won’t take too long.

The command we’ll be using, and we’ll be using it twice, is the ‘ip’ command.

The ‘ip’ Command:

If you’ve got a modern Linux desktop (or server), you’ve got access to the ‘ip’ command. It’s a relative newcomer in the space but it’s pretty universal at this point. 

That’s it. That’s the only tool (other than ‘sudo’) we’ll need for the job. You can verify that ‘ip’ is installed with this command:

which ip

The output should match:

$ which ip
/usr/sbin/ip

If you check the man page, you’ll see why this is the correct tool for the job:

ip – show / manipulate routing, network devices, interfaces and tunnels

We’ll use the command with a couple of different ways to enable and disable your network interface. It’s not terribly complicated.

Enable/Disable Your Network Interface:

Yes, the ‘ip’ command is used in the terminal. That means you’ll need an open terminal. Just press CTRL + ALT + T and your default terminal should open.

With your terminal open, your first step is to identify the network interface:

ip addr

That should look something like this:

It should look something like that. That’s both a wired and wireless network interface.

With that information, the syntax to disable a network connection is simple.

sudo ip link set <interface_name> down

For example:

sudo ip link set enp0s31f6 down

If you’ve disabled the device, it’s just as easy to enable it. The syntax is:

sudo ip link set <interface_name> up

An example would be:

sudo ip link set wlxe4beed0e5f5c up

See?  It’s pretty easy to enable or disable your network interface.

Closure:

If you need to enable or disable your network interface you now know how. That’s a handy thing to know as folks have inadvertently disabled their network interface. This enables it if you did. This also disables your network interface if you’d rather.

Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.

KGIII

Retired mathematician, residing in the mountains of Maine. I may be old and wise, but I am not infallible. Please point out any errors. And, as always, thanks again for reading.

Recent Posts

Check Your NIC Speed In The Terminal

Today's exercise is a nice and simple exercise where we check your NIC speed in…

4 months ago

Easily Monitor Your Wireless Connection

Have you ever wanted to easily monitor your wireless connection? Well, now you can learn…

4 months ago

Count The Files In A Directory

I think I've covered this before with the ls command but this time we'll count…

4 months ago

Get System Information With The ‘uname’ Command In Linux

Today we'll be learning about a basic Linux command that's known as 'uname' and it…

4 months ago

hardinfo Has Been Rebooted As hardinfo2

If you've used hardinfo in the past, it may interest you to know that hardinfo…

4 months ago

Count The Number Of Running Processes Per User

This won't be as complicated as it seems because we're just going to cover how…

4 months ago