4

On previous versions on RHEL/Fedora, the network service could be controlled via init scripts and (later) via systemctl. After updating DNS settings, I want to restart the network service to bounce the interface and pickup the new DNS settings (and force NetworkManager to rewrite /etc/resolve.conf).

Using systemctl, I'm getting:

# systemctl restart network
Failed to restart network.service: Unit network.service not found.

Where'd the network service go and how do I restart the interface to pickup changes?

1
  • Services are now unit types, you can list all the available units by running the command systemctl list-units
    – Bert
    Dec 29, 2020 at 14:27

5 Answers 5

6

Instead of systemctl, use NetworkManager, either via the GUI interface or the nmcli command-line.

Command Line

  1. List the network interfaces on the system (as root):
# nmcli device
DEVICE      TYPE      STATE      CONNECTION         
eno1        ethernet  connected  Wired connection 1     
lo          loopback  unmanaged  --

Note the device name that you want to restart.

  1. Then force the connection to reload:
# nmcli con reload eno1

(Substitute your device name for "eno1")

GUI

  1. Open the 'Settings' application in Fedora.
  2. In the left column, scroll down to 'Network'
  3. Toggle the blue switch off and back on again for the connection to want to restart.
2
  • This has been marked as the solution, but it doesn't work. I've done nmcli con reload eth0, but still cannot even ping google.com or do a simple dnf update. Any ideas on what else to do?
    – Khom Nazid
    Jan 5, 2021 at 16:32
  • @KhomNazid It will work to restart your connection, but it may not solve whatever the larger issue is in your case. Troubleshooting that is probably out of scope for this question.
    – Jeremy
    Jan 5, 2021 at 17:22
2

My internet flakes out often and nmcli con reload ens33 doesn't fix it for me. I always have to run systemctl restart NetworkManager instead.

1
  • While nmcli con reload x seems more surgical this answer is more in line with my experience. Nov 12, 2020 at 15:43
1

Use the following command to restart the server networking service.

# systemctl restart NetworkManager                              

or

# nmcli networking off
# nmcli networking on  

Also nmcli networking on will help you in enabling your networking which might had been disabled somehow.

1
  • 1
    Things to consider: are you administering the server remotely? If so, will your current ssh connection drop if you execute nmcli networking off? If your current connection drops, you obviously cannot run the nmcli networking on to restore the connection. Apr 8, 2022 at 9:00
0

Navigate to /etc/NetworkManager/system-connections/

Edit your respective interface that needs troubleshooting

Add line 4 and don't forget to add the semi-colon at the end

[ipv4]
address1=192.168.100.71/24,192.168.100.1
dns-search=
dns=8.8.8.8;
method=manual

finally run

sudo systemctl restart NetworkManager

If on remote host, the terminal will hang for a bit. Then you will be able to resolve domain names to IP addr's

-1
sudo service NetworkManager restart

Worked on fedora

1
  • All /sbin/service and /sbin/chkconfig commands listed in the table continue to work on systemd-based systems and are translated to native equivalents as necessary. The equivalent of this would be sudo systemctl restart NetworkManager
    – Bert
    Dec 29, 2020 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.