How to Restart a Network Interface in Linux

Restart a Network Interface in Linux

In this post we will discuss how to restart a network interface in Linux. The steps apply to all Linux distributions e.g., Ubuntu, Centos, Suse.

You have to restart a networking interface in Linux from the command line which we will look at in the following steps. Note, the commands have to be run as root via sudo.

The command to bring a network interface up again is:

ifup

The command to take a network interface offline and down is:

ifdown

Beware if you are using any network service such as ssh or accessing the internet taking an interface down will break the connection.

Let’s look at the commands in more detail now.

Restarting Network Interfaces Using the Command Line in Linux

The procedure to to turn off an eth0 interface is as follows. Run:

# ifdown eth0

To turn on an eth0 interface run:

# ifup eth0

To see ip address info use ip command:

# ip a show eth0

Restarting a Network Interface in Ubuntu or Debian

To restart network interface enter:

sudo /etc/init.d/networking restart

To stop and start use the following commands:

sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start

On Debian or Ubuntu Linux you can use systemd too:

$ sudo systemctl restart networking

Restarting a Network Interface in Redhat (RHEL) / CentOS / Fedora / Suse / OpenSuse

To restart a network interface, enter:

# /etc/init.d/network restart

To stop and start use the following commands:

# /etc/init.d/network stop
# /etc/init.d/network start

For Fedora/RHEL/CentOS/Suse Linux use systemd:

$ sudo systemctl restart network

Summary

In this post we have discussed how to restart a network interface in Linux for all Linux distributions e.g., Ubuntu, Centos, Suse.