OSETC TECH

Linux: Restart Network Interface

This post will guide you how to restart network interface using command lines in Linux operating system. How do I restart network interface after editing /etc/network/interfaces or others network configuration on CentOS/RHEL/Ubuntu Linux system. How can I restart a particular network interface on Linux.

Linux Restart Network Interface


To restart a network interface in Linux, you can use the ifdown to turn off the given network interface, then using the ifup command to turn on again so that to restart that network interface.
For example, you want to restart network interface eht0, you can execute the following commands:

#ifdown eth0
#ifup eth0

Check IP address Information of a Network Interface

After restarting the network interface, you can use ip or ifconfig command to get the ip address information.

#ip a show eh0

Or

#ifconfig eth0

Outputs:

[root@ol7_x8664 home]# ip a show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:21:06:07:39:29 brd ff:ff:ff:ff:ff:ff
inet 192.168.87.207/22 brd 192.168.87.255 scope global dynamic eth0
valid_lft 5837sec preferred_lft 5837sec
inet6 fe80::221:6ff:fe07:3929/64 scope link
valid_lft forever preferred_lft forever

[root@ol7_x8664 home]# ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.87.207 netmask 255.255.252.0 broadcast 192.168.87.255
inet6 fe80::221:6ff:fe07:3929 prefixlen 64 scopeid 0x20<link>
ether 00:21:06:07:39:29 txqueuelen 1000 (Ethernet)
RX packets 99107441 bytes 28401415314 (26.4 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4287598 bytes 661553330 (630.9 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Restart Network Interface in RHEL/CentOS 6.x

If you are using the rhel or centos 6.x linux, you can execute the following command to restart the network interface service, type:

#/etc/init.d/network restart

or

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

Restart Network Interface in RHEL/CentOS 7.x

If you want to restart network interface for rhel/centos 7.x linux system, you can run the following command:

#systemctl restart network.service

Restart Network Interface in Ubuntu/Debian Linux

To restart network interface for ubuntu or debian linxu system, you can execute the following command:

$ sudo /etc/init.d/networking restart

or

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

or

$ sudo systemctl restart networking

Check the Status of Netowrk Interface Service

To check the status of the network inferface servcie, you can use the following command:

For CentOS/RHEL/Fedora Linux

#systemctl status network

Or

#service network status

Outputs:

[root@ol7_x8664 ~]# systemctl status network
network.service - LSB: Bring up/down networking
Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
Active: active (exited) since Tue 2018-09-04 01:46:13 EDT; 6min ago
Docs: man:systemd-sysv-generator(8)
Process: 25699 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
Process: 25866 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

Sep 04 01:46:12 ol7_x8664 systemd[1]: Starting LSB: Bring up/down networking...
Sep 04 01:46:13 ol7_x8664 network[25866]: Bringing up loopback interface: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 04 01:46:13 ol7_x8664 network[25866]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 04 01:46:13 ol7_x8664 network[25866]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 04 01:46:13 ol7_x8664 network[25866]: Could not load file '/etc/sysconfig/network-scripts/ifcfg-lo'
Sep 04 01:46:13 ol7_x8664 network[25866]: [ OK ]
Sep 04 01:46:13 ol7_x8664 network[25866]: Bringing up interface eth0: Connection successfully activated (D-Bus active path: /org/freedesktop/...ection/1)
Sep 04 01:46:13 ol7_x8664 network[25866]: [ OK ]
Sep 04 01:46:13 ol7_x8664 systemd[1]: Started LSB: Bring up/down networking.
Hint: Some lines were ellipsized, use -l to show in full.

For Ubuntu/Debian Linux

$ sudo systemctl status networking

or

$ sudo service networking status