How To Restart Network on Ubuntu

This guide intends to show you How To Restart the Network or Networking on your Ubuntu server from CLI. You can use this guide for Ubuntu 20.04 or Ubuntu 22.04.

Every computer is connected to some other computer through a network whether internally or externally to exchange some information. This network can be small as some computers are connected in your home or office or can be large or complicated as in large Universities or the entire Internet.

Maintaining a system’s network is a task of the System/Network administrator. Their task includes network configuration and troubleshooting.

If a problem occurs with the network, then its easy treatment is to restart the network. 

To restart Networking on your Ubuntu server, follow the steps below.

Steps to Restart Network on Ubuntu

To complete this guide, you must log in to your server as a root or non-root user with sudo privileges. To do this, you can follow our Initial guides:

Initial Server Setup with Ubuntu 20.04

Initial Server Setup with Ubuntu 22.04

Restart Networking on Ubuntu From CLI

You can easily restart your Network by using the NetworkManager, systemd, and nmcli.

Let’s see how to do that.

Restart Network with NetworkManager

NetworkManager is a program for providing detection and configuration for systems to automatically connect to networks.

To restart networking, you can easily run the following command:

sudo service network-manager restart

Restart Network with systemd

systemd is a Linux initialization system and service manager that includes features like on-demand starting of daemons, mount and automount point maintenance, snapshot support, and processes tracking using Linux control groups. systemd provides a logging daemon and other tools and utilities to help with common system administration tasks.

You can easily restart networking on your Ubutnu server by using the command below:

sudo systemctl restart NetworkManager.service

Restart Network with Nmcli Command

nmcli is a command-line tool for controlling NetworkManager and reporting network status.

To restart your Networking on Ubuntu, you need to turn off and turn back on the network:

# sudo nmcli networking off
# sudo nmcli networking on

Also, you can use other commands to restart your Network.

Restart Network with ifup and ifdown Commands

ifup activates a network interface, making it available to transmit and receive data.

The ifdown command disables a network interface, placing it in a state where it cannot transmit or receive data.

To use them on your Ubuntu server, you need to install them by using the command below:

sudo apt update && sudo apt install ifupdown -y

Then, you can use the following commands to turn off the network and turn back it on:

sudo ifdown -a && sudo ifup -a

Another way that you can use to restart your Network on Ubuntu is to use the IP command.

Restart Network with IP Command

The ip command is a Linux net tool for system and network administrators.

To restart your network, find the target network interface by using the command below:

ip link show
Example Output
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 00:08:3e:76:a1:5a brd ff:ff:ff:ff:ff:ff
    altname enp0s3
    altname ens3

Here the eth0 is our target. You can easily restart your Network interface on Ubuntu by using the commands below:

# sudo ip link set eth0 down
# sudo ip link set eth0 up

That’s it, you are done.

Conclusion

At this point, you have learned to Restart the Network or Networking on your Ubuntu server from CLI.

Hope you enjoy it.

You may be like these articles:

Manage Networking with Netplan on Debian / Ubuntu

Disable NetworkManager on AlmaLinux 8

Monitor Linux Network Bandwidth Usage with nload Command

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!