I flushed my kernel routing table and wanted to return to using the network but found every server unreachable. I ended up rebooting my computer to restore functionality. Can you help me identify what I could have done, short of rebooting?
My actions were as follows:
# Write my current routes to a file
ip route show > "saved-routes.txt"
# Flush the routing table. After this, `ip route show` outputs nothing
sudo ip route flush table 0
# Restore my saved routes
cat "saved-routes.txt" | while read -a line; do sudo ip route add "${line[@]}"; done
After these actions, I couldn't reach any servers on the internet. So I tried restarting some services:
sudo systemctl start network-manager.service
sudo systemctl start systemd-resolved.service
systemd-resolved.service
wouldn't restart. Checking the status with systemctl
reveals:
● systemd-resolved.service - Network Name Resolution
Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2022-01-24 07:13:35 PST; 11min ago
Docs: man:systemd-resolved.service(8)
https://www.freedesktop.org/wiki/Software/systemd/resolved
https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
Process: 16519 ExecStart=/lib/systemd/systemd-resolved (code=exited, status=1/FAILURE)
Main PID: 16519 (code=exited, status=1/FAILURE)
Error: 99 (Cannot assign requested address)
Jan 24 07:13:35 mymachine systemd[1]: systemd-resolved.service: Scheduled restart job, restart counter is at 5.
Jan 24 07:13:35 mymachine systemd[1]: Stopped Network Name Resolution.
Jan 24 07:13:35 mymachine systemd[1]: systemd-resolved.service: Start request repeated too quickly.
Jan 24 07:13:35 mymachine systemd[1]: systemd-resolved.service: Failed with result 'exit-code'.
Jan 24 07:13:35 mymachine systemd[1]: Failed to start Network Name Resolution.
Jan 24 07:13:42 mymachine systemd[1]: systemd-resolved.service: Start request repeated too quickly.
Jan 24 07:13:42 mymachine systemd[1]: systemd-resolved.service: Failed with result 'exit-code'.
Jan 24 07:13:42 mymachine systemd[1]: Failed to start Network Name Resolution.