How to Restart Network Services in Ubuntu 24.04

Restart network services in Ubuntu 24.04

Ubuntu, the well-known operating system, is known for its ease of use as well as stability. However, like any complex system, sometimes it’s necessary to restart network services to resolve connectivity issues or apply configuration changes. In Ubuntu 24.04, restarting network services can be a routine task for managing connections and troubleshooting issues. The process is straightforward and can be done using the command line or GUI. This article focuses on restarting network services in Ubuntu 24.04.

Ubuntu 24.04, the latest LTS release, offers several methods to manage network services, ensuring users can maintain a seamless and efficient networking experience.

Table of Content

How to Restart Network Services in Ubuntu 24.04

Before diving into the methods, it’s essential to understand that Ubuntu primarily uses NetworkManager to manage network connections. This service is responsible for handling Wi-Fi, Ethernet, and other network interfaces.

Method 1: Using Systemd

This is the most efficient as well as common method for restarting network services in the Ubuntu system. Systemd is the init system and system manager that has become the new standard for Linux distributions. For restarting network services through systemd, users can utilize the following command:

sudo systemctl restart NetworkManager

sudo systemctl restart NetworkManager

This command restarts the NetworkManager service, which is responsible for managing network connections on Ubuntu. This command gracefully stops and starts the NetworkManager service.

Method 2: Using NetworkManager Command Line Interface (nmcli)

For more advanced users, nmcli can be used to manipulate network connections. The nmcli is a utility for reporting network status as well as controlling NetworkManager. To restart network services with nmcli, follow these steps:

List available connections:

For listing available connections, users can utilize the nmcli command:

nmcli connection show

nmcli connection show

1. Turn off networking:

For turning off networking, users can utilize the sudo nmcli connection down <connection_name> command:

sudo nmcli networking off

sudo nmcli networking off

2. Turn networking back on:

For turning on networking, users can utilize the nmcli command:

sudo nmcli networking on

sudo nmcli networking on

3. Reconnect a connection:

For reconnection networking, users can utilize the sudo nmcli connection up <connection_name> command:

sudo nmcli connection up <connection_name>

4. Verifying the Restart

After restarting the network, you can verify the status using:

nmcli general status

nmcli general status

This provides information about your network connection. This method is straightforward and is often preferred by system administrators for its simplicity.

Method 3: Using NetworkManager Text User Interface (nmtui)

The nmtui is a text-based user interface for NetworkManager. It provides a simple and interactive way to manage network configurations. To restart network services using nmtui, simply type:

nmtui

Then navigate through the menu to ‘Activate a connection’,

nmtui

Now, select the desired network, and deactivate/reactivate it as needed:

nmtui

Note: Remember to always verify the restart and ensure that your network is operational after performing any changes.

Method 4: Using ifup and ifdown

While less common in newer Ubuntu versions, you can still use ifup and ifdown for more granular control over network interfaces. These commands are less common in newer versions of Ubuntu but are still available for use:

Identify your network interface:

This lists all active network interfaces:

ip a

ip a

1. Bring the network interface down:

The ifup and ifdown commands are used to bring network interfaces up or down, respectively:

sudo ifdown <interface_name>

Replace <interface_name> with the actual name of your interface (e.g., eth0, wlp0s20f3).

sudo ifdown enp0s3

sudo ifdown enp0s3

2. Bring the network interface back up:

Let’s the network interface up with the ifup command:

sudo ifup enp0s3

sudo ifup enp0s3

Note: Be cautious when using these commands, especially if you are connected remotely, as they can disrupt your connection. It’s important to note that if you’re connected remotely, you should be cautious when restarting network services to avoid losing your connection.

Method 5: Restarting Networking Service

Each method of restarting network services in Ubuntu 24.04 has its own use case and benefits. For a more traditional approach, you can restart the entire networking service with:

sudo systemctl restart NetworkManager.service

sudo systemctl restart NetworkManager.service

This command stops and then starts the networking service, effectively restarting it.

By following these methods, you should be able to effectively restart network services in Ubuntu 24.04.

Note: Whether you prefer the simplicity of nmcli, the interactivity of nmtui, or the traditional approach of restarting the networking service, Ubuntu provides the flexibility to manage your network services efficiently.

Conclusion

For the command line, the systemctl command is commonly used to restart the NetworkManager service in Ubuntu. It can be done by executing sudo systemctl restart NetworkManager.service. This command prompts the network icon to disappear momentarily as the service restarts.

Alternatively, the nmcli tool provides a simple way to turn networking off and on with sudo nmcli networking off and sudo nmcli networking on. For those who prefer a graphical interface, the Network Manager GUI offers an intuitive way to manage network connections, including restarting services.

For more detailed information and additional options, you can refer to the official Ubuntu documentation or community resources.

Keep visiting LinuxWorld for more interesting guides.