Restart linux networking service

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.

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.

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.

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.

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.

Fedora,CentOS

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

Restart Network

Now we can restart our network or network services.

Источник

Ubuntu Linux Restart Network Service

I am a new Ubuntu Linux user and using it on my HP Laptop. Now, I need to restart my network service. How do I restart network under Ubuntu Linux? How can I restart networking service on Ubuntu LTS server? How do I successfully restart a network service without rebooting Ubuntu box?

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 1m

Ubuntu Linux comes with a script called networking (Ubuntu restart network command). This script is used to activates or deactivates or restart all network interfaces (NIC) configured to start at boot time.

Ubuntu Linux restart network command

Open shell or terminal and type the command as follows:
$ sudo /etc/init.d/networking restart
You can also use the following command:
$ sudo service networking restart
Sample outputs:

You can use this command on remote Ubuntu Linux server without any problem, but make sure you pass only restart option. This command also accepts start and stop options:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

The start and stop option

To start or stop service:
$ sudo /etc/init.d/networking start
$ sudo /etc/init.d/networking stop

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Ubuntu Restart Networking Command

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 1m

How to restart network in Ubuntu Server:

  1. /etc/init.d/networking restart script based command.
  2. service restart networking – Use service to run a System V init script such as networking.
  3. systemctl restart networking – Restart networking for the latest version of Ubuntu server.

The syntax is as follows to restart the networking on Ubuntu or Debian based operating systems.

Task: Restart networking under Ubuntu Linux

Open the terminal (bash shell command line) and type the following commands on the latest version of Ubuntu 16.04 or above :
$ sudo systemctl restart networking
OR
$ sudo systemctl restart networking.service
To verify status and connectivity, enter:
$ sudo systemctl status networking.service
$ ip r ## show routing info ##
$ ip a show eth0 ## show info for eth0 interface ##
$ ip a show br0 ## show info for br0 interface replace br0 with your actual interface ##
$ ping cyberciti.biz
Sample session from above commands:

Fig.01: How to restart network service in Ubuntu server

How to restart the networking service ( Ubuntu version 14.04LTS or older )?

You can use the service command following as well:
$ sudo service networking restart

Warning : Do not stop networking service over ssh session.

To start networking service, enter :

$ sudo /etc/init.d/networking start
OR
$ sudo service networking start

To stop networking service, enter:

$ sudo /etc/init.d/networking stop
OR
$ sudo service networking stop

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

A note about desktop users

If above command failed, try the following command:
$ sudo service network-manager restart
OR systemd based Ubuntu system (latest version:
$ sudo systemctl restart network-manager

See also:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

Interestingly enough, this command now says it is deprecated (due to a change in Debian code[1]). I think it still works, though probably for a limited time.

I like this site , really rich collection of solutions

i am from bangladesh , working as Project Manager

My wish to developed myself as a High level linux administrator

this site help me a lot daily

slam i want to learn networking configuration in ubuntu using terminal

i cannot execute the “service network restart”
it”ll display network unrecogonized service.
And also my apache is not working well.
after restarting apache ,apache page is not displaying after typing the localhost in my ubuntu system.
please help me guys.
thanks in advance.

thnq.
such a helpfull site!!

The correct syntax to restart network in Ubuntu Server for the second option is:
2. service networking restart

Источник

How to Restart Network Interface in Linux

Restart Network Interface Using Command Lines in Linux (generic method)

The procedure to to turn off eth0 interface is as follows. Run:
# ifdown eth0
To turn on eth0 interface run:
# ifup eth0
See ip address info using the ip command:
# ip a show eth0

Debian / Ubuntu Linux restart network interface

To restart network interface, enter:
sudo /etc/init.d/networking restart
To stop and start use the following option (do not run them over remote ssh session as you will get disconnected):
sudo /etc/init.d/networking stop
sudo /etc/init.d/networking start
Debian/Ubuntu Linux with systemd, run:
$ sudo systemctl restart networking

Redhat (RHEL) / CentOS / Fedora / Suse / OpenSuse Linux – Restart network interface in Linux

To restart network interface, enter:
# /etc/init.d/network restart
To stop and start use the following option (do not run them over remote ssh session as you will get disconnected):
# /etc/init.d/network stop
# /etc/init.d/network start
Fedora/RHEL/CentOS/Suse Linux with systemd, run:
$ sudo systemctl restart network

Slackware Linux restart commands

Type the following command:
/etc/rc.d/rc.inet1 restart
You can take down or restart particular interface such as eth1 as follows:
# /etc/rc.d/rc.inet1 eth1_restart
# /etc/rc.d/rc.inet1 eth1_start ### start eth1 ###
# /etc/rc.d/rc.inet1 eth1_stop ### stop eth1 ###

How to see status of network/networking service

Run command:
$ sudo systemctl status network #CentOS/RHEL/Fedora/Suse
$ sudo systemctl status network #Debian/Ubuntu
Sample outputs:

Источник

Перезапуск сети в Ubuntu

В Ubuntu и Debian инициализацией сетевых интерфейсов и настройкой сети занимается специальная сетевая служба — networking. Информация о конфигурации сетевых интерфейсов хранится в файле /etc/network/interfaces.

Если вы что-либо измените в этом файле, нужно будет перезапустить сеть, чтобы применить изменения. В этой статье мы рассмотрим как выполнить перезапуск сети Ubuntu 16.04.

Перезагрузка сети в Ubuntu

Можно, конечно, выполнить полную перезагрузку компьютера, но это не совсем удобно если можно просто перезапустить сеть Ubuntu. Для перезапуска сети используйте следующую команду:

sudo service networking restart

В современных дистрибутивах уже давным давно используется система инициализации Systemd, поэтому можно использовать команду systemctl вместо команды service:

sudo systemctl restart networking.service

Кроме того, можно перезапустить NetworkManager, это тоже помогает, если сеть настроена через него:

sudo systemctl restart NetworkManager

Перезапуск сети в NetworkManager

Чаще всего, для управления сетью в современных дистрибутивах используется программа Network Manager. Можно сразу же использовать ещё для наших целей. Просто отключите, а затем включите сеть обратно следующими командами:

sudo nmcli networking off

sudo nmcli networking on

После отключения сети значок NetworkManager пропадёт с панели, а потом снова появится после включения. Аналогично, вы можете использовать NetworkManager в графическом интерфейсе. Кликните по его иконке, выберите нужное сетевое подключение и нажмите Выключить:

Затем включите его обратно.

Команды ifup и ifdown

Эти команды работают на более низком уровне, они управляют непосредственно самими сетевым интерфейсами. Для перезапуска сети мы можем отключить все интерфейсы, а затем включить обратно:

Вы не увидите никаких изменений в графическом интерфейсе, но когда сетевой интерфейс будет отключён, вы не будете иметь доступа к интернету.

Выводы

Как видите, не всегда обязательно перезагружать компьютер после изменений настроек, в большинстве случаев достаточно перезапустить только нужный сервис. Надеюсь, эта информация была вам полезной.

Источник

Читайте также:  Windows 10 download release
Оцените статью