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
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
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 0 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |