
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.
我已经更改了网络配置,并希望重新启动以使更改生效。 或者我的网络存在一些问题,我认为重新启动它可以解决我的问题。 在这里,我们将研究如何在各种网络发行版(如Ubuntu,Debian,Fedora,CentOS)中重新启动网络服务。
获取网络服务状态 (Get Status Of Network Service)
We will get status of network with the following command.
我们将使用以下命令获取网络状态。
Debian,Ubuntu,Kali (Debian, Ubuntu, Kali)
For deb
based distributions we will use init.d
system. We will provide status
option to the networking
script.
对于基于deb
的发行版,我们将使用init.d
系统。 我们将为networking
脚本提供status
选项。
$ /etc/init.d/networking status

As we cab see that networking service is active from given date. Its PID is 897 .
正如我们看到的那样,网络服务从给定日期开始处于活动状态。 其PID为897。
CedOS的Fedora (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.
对于CentOS,RedHat,Fedora等发行版,我们将使用systemctl
命令。 我们将提供选件status
和network
,这是网络服务。
$ systemctl status network

停止网络服务(Stop Network Service)
We can stop network like below. Bu keep in mind for remote connection it can be create problems with ssh
我们可以像下面那样停止网络。 Bu记住要进行远程连接,这可能会给ssh造成问题
Ubuntu,Debian,Kali(Ubuntu, Debian, Kali)
We will use stop
option with networking
command in order to stop network services in Ubuntu, Debian, Kali, Mint etc.
我们将在networking
命令中使用stop
选项,以便在Ubuntu,Debian,Kali,Mint等中停止网络服务。
$ sudo /etc/init.d/networking stop

CedOS的Fedora(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.
我们将再次使用systemctl
和stop
选项,该选项将停止网络服务。 我们还需要通过sudo
命令获得的root特权。
$ sudo systemctl stop network
启动网络 (Start Network)
We can start network like below.
我们可以像下面这样启动网络。
Ubuntu,Debian,Kali (Ubuntu, Debian, Kali)
We will provide start
option in order to start network services in deb based distributions.
我们将提供start
选项,以便在基于deb的发行版中启动网络服务。
$ sudo /etc/init.d/networking start
CedOS的Fedora (Fedora,CentOS)
We will use start network
option in order to start network services in rpm
based distributions.
我们将使用start network
选项来启动基于rpm
的发行版中的网络服务。
$ sudo systemctl start network
重新启动网络 (Restart Network)
Now we can restart our network or network services.
现在,我们可以重新启动网络或网络服务。
Ubuntu,Debian,Kali (Ubuntu, Debian, Kali)
$ /etc/init.d/networking restart
CedOS的Fedora (Fedora,CentOS)
$ systemctl restart network

翻译自: https://www.poftut.com/start-stop-restart-networking-linux/
linux重新启动网络