Networking

Bring Your Network Up Or Down (In The Terminal)

In today’s article, we’re going to learn how to bring your network up or down – in the terminal, of course. This will be an article that’s easy enough for a beginner to understand. It’s not very complicated, so it should also be fairly short. If you’re interested in bringing your network up or down in the terminal, read on!

There are times when you may want to bring your network down and then bring it back up. Odds are that you can do this with a GUI, often with a network manager right there in your system tray.

You can also do this in the terminal. This is especially handy if we’re unable to reach a graphical state and need a network connection for things like updating and troubleshooting. We will use the ‘ip’ command for this, which is a pretty robust command. The ‘ip’ command describes itself as:

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

That’s an accurate description and we will indeed be manipulating network interfaces in this article. We will also be showing network interfaces in this article.

If you’d like to get a head start, you can read the man page:

man ip

That command will show you all the available options for the ‘ip’ command. We’ll just be using a couple of the commands, so it won’t be all that complicated or stressful.

Bring Your Network Up Or Down:

As the title suggests, we’ll be managing our network interfaces from the terminal. This means you’ll need to open your favorite terminal emulator at this point. If you don’t know how to open the terminal, you can do so with your keyboard – just press CTRL + ALT + T and your default terminal should open.

With your terminal now open, you should identify your network interfaces. We can do this with the ‘ip’ command, like so:

ip addr

Or just:

ip a

Hint: The connected device(s) will be those with the most information output. Like the wireless network interface in the following image:

As you can guess, that rectangle is a good indicator that it’s the ‘up’ network interface.

Now, if the network interface is down and you want to bring it up. The command is quite simple, it’s just:

sudo ip link set dev <interface> up

So, in my case, the command would look like this:

sudo ip link set dev wlxe4beed0e5f5c up

If you wanted to bring it down, and mine is already up, the command would look like this:

sudo ip link set dev <interface> down

With that, you can bring your network up or down as desired, and from the terminal. It’s not very difficult at all.

If you’re using an older distro, you might still be using ‘ifconfig’. If you are, the commands are a little different, and I include these only for completeness’ sake and would look like this:

sudo ifconfig <interface> up

And, of course, to bring the network interface down:

sudo ifconfig <interface> down

So, that’s not too dissimilar to the more modern ‘ip’ command and is still worth mentioning. For a while, as ‘ifconfig’ was sunsetted, you could use both commands with the Ubuntu flavors. In current versions of Ubuntu, you only have the ‘ip’ command available unless you install ‘net-tools’ for some reason.

Closure:

And there you have it! You can now bring your network up or down in the terminal, and it’s not even all that difficult. It’s yet another article and yet another skill you can add to your growing toolbox of commands. It’s just a subset of the things you can do with the ‘ip’ command, but it’s one of the more useful things you can do with it. So, there’s that…

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 own 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

A Quick Look At The Shutdown Command

This is going to be just a quick article about a command many of you…

12 hours ago

Setting Up Coding Environments on Linux for Educational Use

With so many strong attributes, such as robustness and flexibility, Linux stands as a powerful…

2 days ago

View Detailed Hardware Information

There are many tools for showing your hardware information and today we'll get to view…

4 days ago

How To: Install Wine In Lubuntu

Today's article isn't going to be complicated or long as we are going to cover…

6 days ago

Update Python Packages (PIP)

We've had a run of Python packages recently and you can tell that I'm a…

1 week ago

Save A Command’s Output To A File (While Showing It In The Terminal)

The title is the best I can come up with to describe this exercise as…

1 week ago