Start network service in linux

Linux network services: How to start, stop, and check their status

Traffic light on green

A service (also called a daemon process) is software that runs on a computer, generally in the background. This is usually because it’s something that the administrator isn’t likely to interact with directly.

Training & certification

For instance, a network service runs at the application layer to provide some form of service over a network. It’s expected that client computers will contact the service for access. A common example is the Apache web server. It runs on a system so that devices connected to the internet can view a specific set of files on a computer.

Red Hat Enterprise Linux (RHEL) provides an environment where these network services can run. RHEL also provides a utility named systemd to help you manage these services.

systemd has been the default service manager since RHEL 7. It’s the first thing that gets started (PID 1), and it is responsible for starting the rest of the system. It activates server daemons, system resources, and various other processes. With systemd, you can start, stop, and check the status of the network services running on your server. You interact with systemd by using the systemctl command.

Start a service

To start a given service, use:

For example, to start the sshd service, type:

$ sudo systemctl start sshd.service

You can ignore .service and run the systemctl start sshd command.

List services

You can list all loaded services on a server with:

$ sudo systemctl list-units --type=service

Stop a service

To find out whether a service is running, inactive, enabled, disabled, or has exited, use:

$ sudo systemctl status sshd

The systemctl command also has is-active and is-enabled options to see whether a service is active or enabled. For example, to check if a service is active or enabled, run:

Читайте также:  Linux which php ini

IT Automation ebook

This command gives two possible outputs. The service is either active , which means it is running, or it’s inactive , which means it is stopped or not running.

Enable a service

You can configure a service to start automatically with the system so that you don’t have to start it manually after the server reboots or restarts.

To enable a service, which means the service starts automatically when the server boots, use:

$ sudo systemctl enable sshd

To both start and enable a service, add the —now option, like this:

$ sudo systemctl enable --now sshd

To check whether a service is enabled, enter:

$ sudo systemctl is-enabled sshd

When a service is enabled, it starts automatically at boot. When it’s disabled, it doesn’t start automatically at boot.

Disable a service

To disable a service, so the service will not start automatically at boot time, run:

$ sudo systemctl disable sshd

Wrap up

Not everything uses systemctl by default. Some applications are intended to be started manually. Of course, you can always add your own systemd service files when you need a network service to start automatically.

Systemd is full of features, and the systemctl command gives you easy control over the services your computer runs.

Источник

How To Start / Stop / Restart Network Service in OpenSUSE Linux

How To Start / Stop / Restart Network Service in OpenSUSE Linux 1

In this tutorial, I will take you through the steps to Start / Stop / Restart Network Service in OpenSUSE Linux. If you are performing some changes in network configuration file then you always need to stop/start/restart network service for changes to take effect. Similarly if you are troubleshooting any network issue then also you might need to restart network service few times. There are few commands available in OpenSUSE Linux which can be used to stop/start/restart network service in Linux. We will go through those commands and understand the usage with the help of examples.

How To Start / Stop / Restart Network Service in OpenSUSE Linux

How to Start / Stop / Restart Network Service in OpenSUSE Linux

1. How to Start Network Service in OpenSUSE Linux

If you want to start your network service in OpenSUSE Linux then you need to use service network start command as shown below. Alternatively you can also use systemctl start network command to start network service.

How To Start / Stop / Restart Network Service in OpenSUSE Linux 2

Please note that here I am using root user to run all the below commands. You can use any user with sudo access to run all these commands. For more information Please check Step by Step: How to Add User to Sudoers to provide sudo access to the User.

2. How to Stop Network Service in OpenSUSE Linux

If you want to stop network service then you need to use service network stop command as shown below. Alternatively you can also use systemctl stop network command to stop network service.

Читайте также:  Сеть windows linux нет доступа

How To Start / Stop / Restart Network Service in OpenSUSE Linux 3

3. How to Check Status of Network Service in OpenSUSE Linux

If you want to check the status of Network Service then you need to use service network status command as shown below.

How To Start / Stop / Restart Network Service in OpenSUSE Linux 4

Alternatively you can also use systemctl network status command to check the status of network service.

localhost:~ # systemctl status networkNetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/NetworkManager.service.d └─NetworkManager-ovs.conf Active: active (running) since Thu 2020-12-17 22:34:34 IST; 46s ago Docs: man:NetworkManager(8) Main PID: 2875 (NetworkManager) Tasks: 3 CGroup: /system.slice/NetworkManager.service └─2875 /usr/sbin/NetworkManager --no-daemon Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.0954] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-stat> Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.1230] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-st> Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.1234] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-s> Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.1241] manager: NetworkManager state is now CONNECTED_LOCAL Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.1258] manager: NetworkManager state is now CONNECTED_SITE Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.1259] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: nisdomainname: you must be root to change the domain name Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.4903] device (eth0): Activation: successful, device activated. Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.4912] manager: startup complete Dec 17 22:34:35 localhost.localdomain NetworkManager[2875]: [1608224675.6314] manager: NetworkManager state is now CONNECTED_GLOBAL

4. How to Restart Network Service in OpenSUSE Linux

If you want to restart your network service then you need to use service network restart command as shown below. Alternatively you can also use systemctl restart network command to restart network service.

How To Start / Stop / Restart Network Service in OpenSUSE Linux 5

5. How to Check Network Manager Status in OpenSUSE Linux

If you want to check Network Manager status then you need to use service NetworkManager Status command as shown below.

How To Start / Stop / Restart Network Service in OpenSUSE Linux 6

Alternatively you can also use systemctl NetworkManager status command to check the status of network manager service.

localhost:~ # systemctl status NetworkManagerNetworkManager.service - Network Manager Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled) Drop-In: /usr/lib/systemd/system/NetworkManager.service.d └─NetworkManager-ovs.conf Active: active (running) since Thu 2020-12-17 22:34:34 IST; 11h ago Docs: man:NetworkManager(8) Main PID: 2875 (NetworkManager) Tasks: 3 CGroup: /system.slice/NetworkManager.service └─2875 /usr/sbin/NetworkManager --no-daemon Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5114] device (eth0): state change: ip-config -> ip-check (reason 'none', sys-iface-stat> Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5332] device (eth0): state change: ip-check -> secondaries (reason 'none', sys-iface-st> Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5340] device (eth0): state change: secondaries -> activated (reason 'none', sys-iface-s> Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5350] manager: NetworkManager state is now CONNECTED_LOCAL Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5369] manager: NetworkManager state is now CONNECTED_SITE Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.5372] policy: set 'Wired connection 1' (eth0) as default for IPv4 routing and DNS Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: nisdomainname: you must be root to change the domain name Dec 18 08:39:33 localhost.localdomain NetworkManager[2875]: [1608260973.9143] device (eth0): Activation: successful, device activated. Dec 18 08:39:34 localhost.localdomain NetworkManager[2875]: [1608260974.2572] manager: NetworkManager state is now CONNECTED_GLOBAL Dec 18 09:48:47 localhost.localdomain NetworkManager[2875]: [1608265127.4577] agent-manager: agent[ba8bd6ffe4b7ff54,:1.26/org.gnome.Shell.NetworkAgent/1000]: a>

Popular Recommendations:-

Читайте также:  Linux xrandr разрешение экрана

Источник

How To Start, Stop, Restart Networking On Linux?

I have changed my network configuration and want to restart to make changes effective. Or there are some problems with my network and I think restarting it will solve my problems. Here we will look at how to restart networking service in various network distributions like Ubuntu, Debian, Fedora, CentOS.

Get Status Of Network Service

We will get status of network with the following command.

Debian, Ubuntu, Kali

For deb based distributions we will use init.d system. We will provide status option to the networking script.

$ /etc/init.d/networking status

Get Status Of Network

As we cab see that networking service is active from given date. Its PID is 897 .

Fedora, CentOS

For distributions like CentOS, RedHat, Fedora we will use systemctl command. We will provide the options status and network which is the networking service.

Get Status Of Network

Stop Network Service

We can stop network like below. Bu keep in mind for remote connection it can be create problems with ssh

Ubuntu, Debian, Kali

We will use stop option with networking command in order to stop network services in Ubuntu, Debian, Kali, Mint etc.

$ sudo /etc/init.d/networking stop

Stop Network Service

Fedora,CentOS

We will use systemctl again with stop option which will stop network services. We also require root privileges that will beget with sudo command.

$ sudo systemctl stop network

Start Network

We can start network like below.

Ubuntu, Debian, Kali

We will provide start option in order to start network services in deb based distributions.

$ sudo /etc/init.d/networking start

Fedora,CentOS

We will use start network option in order to start network services in rpm based distributions.

$ sudo systemctl start network

Restart Network

Now we can restart our network or network services.

Ubuntu, Debian, Kali

$ /etc/init.d/networking restart

Fedora,CentOS

$ systemctl restart network

Источник

Оцените статью
Adblock
detector