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
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
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 ###
Run command:
$ sudo systemctl status network #CentOS/RHEL/Fedora/Suse
$ sudo systemctl status network #Debian/Ubuntu
Sample outputs:
Источник
In this article, I will show you how to configure the network easily and restart them properly on Debian Linux. Let’s get started.
On Debian Linux, the network configuration is stored in /etc/network/interfaces file. On older version of Debian, when you make changes to /etc/network/interfaces file, you can restart networking with the following command:
The network service should be restarted. But on Debian 9 Stretch, that no longer works due to a bug.
You can directly configure a network interface using /etc/network/interfaces file manually if you like. But the good news is, you don’t have to do that. On recent Linux distributions such as Debian 9 Stretch, networking can be managed by the Network Manager. It makes configuring a network really easy. Network Manager has command line utilities for network configuration.
If you have minimal server version of Debian 9 Stretch installed, you may not have Network Manager installed. In that case, you have to install Network Manager.
First update the package repository cache with the following command
The package repository cache should be updated.
Now install Network Manager with the following command:
Press y and then press to continue.
Network Manager should be installed.
Network Manager has nmtui terminal based interactive tool that you can use to configure networking on Debian 9 Stretch.
To start nmtui, run the following command:
You should see the following window. From here you can set hostname, edit/add network connection, and active/deactivate network connections that you created.
To create a connection, go to Edit a connection. Then press to select and then press .
Now select your connection method. I am going for Ethernet as I have a wired connection. Now press and select and then press .
Now type in a Profile name. It can be anything you want. I recommend you make it short and easy. Now type in a Device identified. I have only one physical Ethernet cable connected to my computer and is recognized as ens33, so I typed that. You can run ip link show command to find out your Device identifier.
If you want to use DHCP to get the IP address for this network interface, then that’s pretty much everything you need to do. But if you want to assign a static IPv4 or IPv6 address, then you have to press to go to for IPv4 CONFIGURATION or IPv6 CONFIGURATION or both depending on your need. Then press . Then you should see something like this. Type in your IP Address, Gateway, DNS servers information, Routing and other information.
Once you’re done, scroll down using the and go to and then press .
Your connection should be created and activated.
NOTE: Network Manager do not manage interfaces defined in /etc/network/interfaces file. So if the interface you’re configuring with Network Manager is also configured using the /etc/network/interfaces file, then be sure to comment it out or remove it from the /etc/network/interfaces file for Network Manager to work with that interface.
In the earlier section, I showed you how to create a connection using Network Manager. In this section I will show you how to restart the connection.
When you edit a connection, you must restart the connection for the changes to take effect.
You can use the nmtui utility to restart a connection using the Terminal based user interface.
Run nmtui and go to Activate a connection.
Now select your Connection from the list, in my case the Home Router, then press .
Now while is selected, press to deactivate the connection first.
Now while is selected, press to activate the connection again. Your changes should be applied.
You can do the same thing from the terminal using the nmcli command.
Deactivate the Home Router connection with the following command:
To Activate the Home Router connection again, run the following command:
You can also Restart the connection with a single command:
If you have a lot of connection, which may take a lot of time to restart one by one, then you can just restart the Network Manager service with the following command:
The Network Manager service should restart.
That’s how you Restart Networking Properly on Debian Linux. Thanks for reading this article.
Источник
Restarting the network interface using command lines in Linux is a straight-forward procedure. While the GUI (Graphical User Interface) for Linus network configuration is more graphical and visually appealing, it may actually make restarting the network interface much longer.
In operating systems such as Linux, the command line operations generally accomplish the task faster than the GUI interface. Restarting the network interface by using command lines will require certain user privileges, as well as designation as the system’s root user, or via the Sudo. There are separate commands to restart the network services and to restart a particular network interface.
The process of setting up a network can be quite lengthy, especially if you need to verify that your DHCP server is correctly assigning its IP addresses. A quicker way of restarting the network interface would be to use command lines.
These commands should be executed as root or via sudo. The following commands are specific to debian (Ubuntu or Xandros).
Stop the network interface eth0:
Start the network interface eth0:
Don’t confuse with the following command, which restarts all the networks services :
To see your various network interfaces, use the command:
Источник
В Ubuntu и Debian инициализацией сетевых интерфейсов и настройкой сети занимается специальная сетевая служба — networking. Информация о конфигурации сетевых интерфейсов хранится в файле /etc/network/interfaces.
Если вы что-либо измените в этом файле, нужно будет перезапустить сеть, чтобы применить изменения. В этой статье мы рассмотрим как выполнить перезапуск сети Ubuntu 16.04.
Можно, конечно, выполнить полную перезагрузку компьютера, но это не совсем удобно если можно просто перезапустить сеть Ubuntu. Для перезапуска сети используйте следующую команду:
sudo service networking restart
В современных дистрибутивах уже давным давно используется система инициализации Systemd, поэтому можно использовать команду systemctl вместо команды service:
sudo systemctl restart networking.service
Кроме того, можно перезапустить NetworkManager, это тоже помогает, если сеть настроена через него:
sudo systemctl restart NetworkManager
Чаще всего, для управления сетью в современных дистрибутивах используется программа Network Manager. Можно сразу же использовать ещё для наших целей. Просто отключите, а затем включите сеть обратно следующими командами:
sudo nmcli networking off
sudo nmcli networking on
После отключения сети значок NetworkManager пропадёт с панели, а потом снова появится после включения. Аналогично, вы можете использовать NetworkManager в графическом интерфейсе. Кликните по его иконке, выберите нужное сетевое подключение и нажмите Выключить:
Затем включите его обратно.
Эти команды работают на более низком уровне, они управляют непосредственно самими сетевым интерфейсами. Для перезапуска сети мы можем отключить все интерфейсы, а затем включить обратно:
Вы не увидите никаких изменений в графическом интерфейсе, но когда сетевой интерфейс будет отключён, вы не будете иметь доступа к интернету.
Как видите, не всегда обязательно перезагружать компьютер после изменений настроек, в большинстве случаев достаточно перезапустить только нужный сервис. Надеюсь, эта информация была вам полезной.
Источник
This post will guide you how to restart network interface using command lines in Linux operating system. How do I restart network interface after editing /etc/network/interfaces or others network configuration on CentOS/RHEL/Ubuntu Linux system. How can I restart a particular network interface on Linux.
To restart a network interface in Linux, you can use the ifdown to turn off the given network interface, then using the ifup command to turn on again so that to restart that network interface.
For example, you want to restart network interface eht0, you can execute the following commands:
Check IP address Information of a Network Interface
After restarting the network interface, you can use ip or ifconfig command to get the ip address information.
Restart Network Interface in RHEL/CentOS 6.x
If you are using the rhel or centos 6.x linux, you can execute the following command to restart the network interface service, type:
Restart Network Interface in RHEL/CentOS 7.x
If you want to restart network interface for rhel/centos 7.x linux system, you can run the following command:
Restart Network Interface in Ubuntu/Debian Linux
To restart network interface for ubuntu or debian linxu system, you can execute the following command:
Check the Status of Netowrk Interface Service
To check the status of the network inferface servcie, you can use the following command:
Источник