How to Restart Network Interface in Linux

Posted on in Categories last updated January 23, 2018

How do I restart the network interface under Linux operating systems after making changes to IP configuration without rebooting the server?

You can restart the networking service in Linux using various command. Use the following commands as per your Linux distribution to restart the networking service. You must run the command as root user either using sudo or su commands. The ifup command bring a network interface up. The ifdown command take a network interface down. You must be careful with ifdown command if you are using it over SSH based session.

Restart Network Interface Using Command Lines in Linux (generic method)

The procedure to to turn off eth0 interface is as follows. Run:
# ifdown eth0
To turn on eth0 interface run:
# ifup eth0
See ip address info using the ip command:
# ip a show eth0
Restart Network Interface Using Command Lines in Linux

Debian / Ubuntu Linux restart network interface

To restart network interface, enter:
sudo /etc/init.d/networking restart
To stop and start use the following option (do not run them over remote ssh session as you will get disconnected):
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start

Debian/Ubuntu Linux with systemd, run:
$ sudo systemctl restart networking

Redhat (RHEL) / CentOS / Fedora / Suse / OpenSuse Linux – Restart network interface in Linux

To restart network interface, enter:
# /etc/init.d/network restart
To stop and start use the following option (do not run them over remote ssh session as you will get disconnected):
# /etc/init.d/network stop
# /etc/init.d/network start

Fedora/RHEL/CentOS/Suse Linux with systemd, run:
$ sudo systemctl restart network

Slackware Linux restart commands

Type the following command:
/etc/rc.d/rc.inet1 restart
You can take down or restart particular interface such as eth1 as follows:
# /etc/rc.d/rc.inet1 eth1_restart
# /etc/rc.d/rc.inet1 eth1_start ### start eth1 ###
# /etc/rc.d/rc.inet1 eth1_stop ### stop eth1 ###

How to see status of network/networking service

Run command:
$ sudo systemctl status network #CentOS/RHEL/Fedora/Suse
$ sudo systemctl status network #Debian/Ubuntu

Sample outputs:

* wicked.service - wicked managed network interfaces
   Loaded: loaded (/usr/lib/systemd/system/wicked.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2018-01-13 06:40:25 UTC; 1 weeks 3 days ago
  Process: 93 ExecStart=/usr/sbin/wicked --systemd ifup all (code=exited, status=0/SUCCESS)
 Main PID: 93 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 512)
   CGroup: /system.slice/wicked.service
 
Jan 13 06:40:10 opensuse systemd[1]: Starting wicked managed network interfaces...
Jan 13 06:40:25 opensuse wicked[93]: lo              up
Jan 13 06:40:25 opensuse wicked[93]: eth0            up
Jan 13 06:40:25 opensuse systemd[1]: Started wicked managed network interfaces.

To see info about ip address run:
# ifconfig -a
OR
# ip a
# ip a show
# ip a show eth1

How to restart the networking service on Gentoo

Run the following for eth0:
# /etc/init.d/net.eth0 restart

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 0 comments/add one below):