Linux перезапустить сеть centos

CentOS restart network step-by-step

This tutorial will go through the steps to restart the network on CentOS. We will go through 5 different methods on how you can make this happen.

CentOS restart network step-by-step

List of content you will read in this article:

It is possible to fix temporary issues on specific operating systems, such as Linux, by restarting the network services. Multiple methods are available for restarting network services, including network service restart, network utility, etc. If you cannot make a secure connection with your CentOS system, you should know that a quick restart can solve many issues. Various commands are available for restarting the network on CentOS. But, as a root user, you must execute the commands using the ‘su’ or ‘sudo’ commands. As CentOS is one of the most commonly used and popular distributions of Linux, we’ll review methods of restarting the network service on CentOS. Let’s start.

How to Restart Network Services on CentOS

To restart network services, you can choose one of the methods we identified in this tutorial. These methods are listed below.

Method 1: The “nmcli” command

The ‘nmcli’ command line is offered for network status monitoring and manager access. To restart the network service on CentOS, perform the following instructions.

Step 1: First, click the ‘Activities’ tab to open it. Then, a search bar appears on the screen.

Step 2: In the search bar, search for Terminal and open it.

(Note: you can also open Terminal on your CentOS system using the ‘Ctrl+Alt+T’ keyboard shortcut.)

Step 3: After the terminal is shown, run the following command to turn off the network service:

$ sudo nmcli networking off

After running the ‘nmcli’ command, the networking service will quickly turn off, and you’ll have control of the Terminal without any output.

Step 4: Now, to restart network services on CentOS, you must turn the networking service on again. To do this, run the following command in the Terminal:

Now, the network service will start, and you’ll have control of the Terminal again while no output is displayed.

You have successfully restarted the networking service on CentOS using the ‘nmcli’ command by turning off the networking service and turning it on again.

Method 2: The network manager utility

What is the network manager’s utility? It’s network management software that makes computer networks easier to use. You can use this software utility to restart the network on CentOS. The following steps will show you how to do that:

Step 1: Open the terminal using the ‘Ctrl+Alt+T’ keyboard shortcut or search for the word ‘terminal’ in the search box.

Step 2: Run the following command in the Terminal:

$ sudo systemctl start NetworkManager.service

Now your system will start the networking system quickly, and you’ll have control of the Terminal without any output again.

Читайте также:  Add env variable linux

Step 3: In this step, run the command below in the Terminal to stop the networking service:

$ sudo systemctl stop NetworkManager.service

Again, the network service of your system will stop immediately, control of the Terminal will be given to you, and no output will be displayed.

Step 4: The following command will help you to restart the networking service using the Network Manager utility:

$ sudo systemctl restart NetworkManager.service

The networking service will restart, and you’ll regain control of the Terminal.

Do you want to verify whether your networking service has restarted or not? Run this command in Terminal:

$ sudo systemctl status NetworkManager.service

«active (running)” will appear on your screen if the network manager utility restarted your networking service successfully. So, check it after you run the command shown above.

Method 3: The systemctl command

To configure your network settings, the ‘nmcli’ command can help. You can use the ‘systemctl’ command to restart the network manager service after the network configuration is done.

# systemctl restart NetworkManager

Your network should be updated due to this command, although this command will not affect the interface configuration if NetworkManager does not manage your network.

Method 4: ifup and ifdown commands

If you’re using SSH connections, use the ‘ifup’ and ‘ifdown’ commands with caution because these two commands can destroy the active SSH interface and lock you out of the system. Connecting to your server via the console can recover network access by running this command.

You can use these two commands on CentOS with or without the network manager.

With NetworkManager

Unlike older releases where the ifup and ifdown commands were part of the initscripts rpm, CentOS 8 includes both commands as part of NetworkManager.

It’s possible to use the ifup and ifdown commands to refresh your network configuration. For instance, you made some changes to eth1; bringing down the interface and bringing it up will refresh the changes you’ve made.

In this format, the command must be executed since executing separately will result in the server becoming unreachable.

It will update the network configuration of your system.

Without NetworkManager

To use the ifup and ifdown instructions, install network scripts if NetworkManager doesn’t manage your network interface. To install it, use the following command:

# dnf -y install network-scripts

Now you can check the rpm ownership for ifup using the following command:

In this step, ifup is part of NetworkManager and network-scripts rpm, and you can use the following command

Some WARN syntaxes will be shown for ifup and ifdown actions like this:

WARN : [ifdown] You are using ‘ifdown’ script provided by ‘network-scripts’, which is now deprecated.

WARN : [ifdown] ‘network-scripts’ will be removed in one of the next major releases of RHEL.

WARN : [ifdown] It is advised to switch to ‘NetworkManager’ instead — it provides ‘ifup/ifdown’ scripts as well.

When you use ifup or ifdown without NetworkManager, it throws WARNINGs because network-scripts only support fallback behaviour.

Method 5: nmtui command

If you can’t use the nmcli command and are uncomfortable with it, the ‘nmtui’ command is available for you to manage your network. Deactivating and activating your network interface is possible by entering the nmtui command in the Terminal as a root user:

Читайте также:  Редактор xml файлов linux

Now, a window will appear on your screen. To update the network configuration, select «Activate a Connection».

You can deactivate and reactivate an interface by selecting.

Note: Your SSH connection will be lost if you deactivate an active interface. It is necessary to use nmtui from the graphical console if you intend to restart networking for your primary interface. This is regardless of whether you are connected to the network via SSH.

You can close the nmtui session if your interface is active.

Conclusion

CentOS provides the command “restart network” to restart individual network cards. This tutorial covers how to restart network services with different methods and examples for all CentOS distributions. «Restart network» in CentOS has a proper uncut concept, explanation, example, and alternative commands. You can expect network-scripts support to drop shortly, so you should start switching to NetworkManager. By default, we use the systemctl command to restart the network automatically. This is because it’s required by request. Additionally, we need to learn the other restart methods in place of systemctl.

Let us conclude by wishing you the best of luck in restarting the CentOS Linux network.

People also read:

Источник

CentOS 8 Restart Network

Among the most frequent system administration practices is the process of restarting the network. To connect your machine with the Internet, a sound networking service is always required. At times, due to undesirable issues, the networking service in a particular operating system may start malfunctioning. If the issue is temporary, then it can be resolved simply by restarting your networking service.

There are multiple methods that you can use in any operating system to restart the system’s networking service. Today, we walk you through the two primary methods of restarting the network service in CentOS 8, one of the most popular distributions of the Linux operating system.

If you are using a system based on CentOS 8 and are not able to establish a secure connection with your network, you would be shocked by how many issues a quick restart can solve. You can restart the Linux networking service using various commands, but you must execute the commands to restart the network using sudo or su commands as a root user.

Methods of Restarting Network Service on CentOS 8

To restart the Network service in CentOS 8, you may choose to follow any of the two methods listed below.

Method # 1: Using the “nmcli” Utility

Nmcli is a command-line application used for Network Manager access and network status monitoring. To use the “nmcli” utility to restart the Network service in CentOS 8, perform the following steps:

First, click the Activities tab in your CentOS 8 system, as highlighted in the image shown below:

Performing this action will cause a search bar to appear on your screen, in which you can search for the terminal. You may also open the terminal by using the shortcut Ctrl+Alt+T. The CentOS 8 terminal is shown in the following image:

To restart the Network service in CentOS 8 using the “nmcli” utility, first, turn off the networking service by running the command below in the terminal window that you just launched:


Running this command will immediately turn off the networking service and the control of the terminal will be handed back to you without displaying any output, as shown in the following image:

Next, turn on the networking service by running the following command in the terminal:

Читайте также:  Сменить имя компьютера альт линукс


Running the above command will immediately start the networking service and the control of the terminal will be handed back to you without displaying any output, as shown in the following image:

In this method, you first turned off the networking service and then turned it on. Essentially, you have just restarted the networking service using the “nmcli” utility in CentOS 8.

Method # 2: Using the Network Manager Utility

The Network Manager is a software utility that seeks to make computer networks easier to use. To use the Network Manager utility to restart the Network service in CentOS 8, perform the following steps:

In the terminal, run the following command to start the networking service:


Running this command will immediately start the networking service and the control of the terminal will be handed back to you without displaying any output, as shown in the following image:

Now, stop the networking service by running the following command in the terminal:


Running this command will immediately stop the networking service and the control of the terminal will be handed back to you without displaying any output, as shown in the following image:

Next, restart the networking service using the Network Manager utility by running the following command in the terminal:


Running this command will instantly restart the networking service and the control of the terminal will be handed back to you without displaying any output, as shown in the following image:

You can also verify whether your networking service has restarted by running the following command in the terminal:


If the Network Manager utility has successfully managed to restart the networking service, then you will be able to see the “active (running)” status after executing the command shown above, as highlighted in the following image:

Conclusion

Restarting the network or connection is a task that any Linux user would have to go through. This article presented you with the two easiest and quickest methods of restarting the network service while using CentOS 8. The best thing about both these methods is that they do not require any prior installations; rather, you can just start following these methods straightaway. All you need to do is run a few basic commands, and your network service will be restarted within no time. We hope that we have provided you with the strategies necessary to deal with network restart problems in CentOS 8.

That is all, for now. I hope that you found the tutorial in this article useful for your purposes. After walking through the steps provided in the tutorial, you are now in this position to restart the network easily and conveniently in your CentOS 8 system by following any of the two methods presented.

About the author

Aqsa Yasin

I am a self-motivated information technology professional with a passion for writing. I am a technical writer and love to write for all Linux flavors and Windows.

Источник

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