How To start/Stop/Restart Network Service on Ubuntu or Debian Linux
This post will guide you how to start or restart network service on the latest Ubuntu 18.04 or Debian linux system. How do I start, stop or restart Network service from the command line on your Ubuntu Linux system.
- Displaying Netowrking Configuration File
- Starting Network Service in Ubuntu
- Stop Network Service in Ubuntu
- Restart Network Service in Ubuntu
- Checking Status of Networking Service
- Enabling Netowrk Service in Ubuntu
- Disabling Network Service in Ubuntu
Displaying Netowrking Configuration File
If you are working on a Ubuntu Linux system, and you may be need to set IP address for a given enternet interface or you need to change network settings by modifying networking configuration file called interfaces
located in the /etc/network
directory using your vim text editor. or you can use cat command to dispaly the content of the current networking configuration file, type:
$ sudo vim /etc/network/interfaces
or
$ cat /etc/network/interfaces
Outputs:
devops@devops:~$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp0s3
iface enp0s3 inet dhcp
Starting Network Service in Ubuntu
If your network service daemon is stopped, and you may be need to start it by using the following command:
$ sudo systemctl start networking.service
or
$ sudo /etc/init.d/networking start
Stop Network Service in Ubuntu
If you wish to stop a network service in your Ubuntu or Debian Linux, and you can type the following comand:
$ sudo systemctl stop networking.service
or
$ sudo /etc/init.d/networking stop
Restart Network Service in Ubuntu
If you modified networking configuration in your Ubuntu system, and you need to restart its service by using the following command:
$ sudo systemctl restart networking.service
or
$ sudo /etc/init.d/networking restart
Checking Status of Networking Service
If you need to check the current status of networking service in your Ubuntu system, and you can issue the following command:
$ sudo systemctl status networking.service
Or
$ sudo /etc/init.d/networking status
Outputs:
devops@devops:~$ sudo systemctl status networking.service
networking.service - Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; disabled; vendor preset: enabled)
Active: active (exited) since Tue 2019-10-08 02:59:03 EDT; 18min ago
Docs: man:interfaces(5)
Main PID: 1158 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 1121)
CGroup: /system.slice/networking.service
Oct 08 02:58:59 devops systemd[1]: Starting Raise network interfaces...
Oct 08 02:59:03 devops systemd[1]: Started Raise network interfaces.
Enabling Netowrk Service in Ubuntu
If you want to enable your network service at system boot on your Ubuntu system, and you can run the following command:
$ sudo systemctl enable networking.service
Outputs:
devops@devops:~$ sudo systemctl enable networking.service
Synchronizing state of networking.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable networking
Disabling Network Service in Ubuntu
If you want to diable network service at system boot, just using the following command:
$ sudo systemctl disable networking.service
Conclusion
You should know that how to start/stop/restart/enable/disalbe network service in your Ubuntu or Debian L Linux system.