How do I start a network service in Ubuntu?

I am a new Ubuntu Linux server user and my server located in Amazon data center. How do I start a network service in Ubuntu Linux using the command line?

Ubuntu Linux comes with CLI and graphical utilities to configure your network devices. However, as a server administrators, you need to focus on managing your network on the command line. This page shows how to start, stop, and restart networking service on Ubuntu Linux using the CLI.

ADVERTISEMENTS

Command to start a network service in Ubuntu

The syntax is as follows for the latest version of Ubuntu Linux:
sudo systemctl start networking.service

How do I restart a network service in Ubuntu?

sudo systemctl restart networking.service

How do I stop a network service in Ubuntu?

sudo systemctl stop networking.service

A note about older version of Ubuntu Linux

Try the following syntax to start, stop and restart networking service:
sudo /etc/init.d/networking start
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking restart

Let us see all commands and example in details.

Ubuntu start a network service and see status

List your network interfaces using the ip command:
ip a
ip a s eth0
ip a s ens3

Command to start a network service in Ubuntu Linux

How to view networking configrations

Run the following cat command:
cat /etc/network/interfaces
Sample outputs:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
 
source /etc/network/interfaces.d/*
 
# The loopback network interface
auto lo
iface lo inet loopback
 
# The primary network interface
auto ens3
iface ens3 inet static
	address 192.168.122.17
	gateway 192.168.122.1

How do I change or edit network configuration on Ubuntu?

Edit the /etc/network/interfaces file using a text editor such as vim command/nano command:
sudo nano /etc/network/interfaces
OR
sudo vi /etc/network/interfaces
Once file updated, restart networking service, run:
sudo systemctl restart networking.service

How do I see status of networking service on Ubuntu?

Simply run the following command at the CLI:
sudo systemctl status networking.service
Ubuntu start a network service command

Conclusion

This page showed how to start, restart and stop the networking service on an Ubuntu Linux system using the command line. For more info see this page here.

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS

Comments on this entry are closed.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.