2024-04-20 07:40:34 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -x
|
2024-05-10 18:35:07 +03:00
|
|
|
# In my experience killswitch causes issues for NordVPN to restore connection
|
|
|
|
# and anyway it's enabled by scripts that I actually want to be connected to
|
|
|
|
# VPN.
|
2024-04-20 07:40:34 +03:00
|
|
|
nordvpn set killswitch off
|
2024-05-10 18:35:07 +03:00
|
|
|
# The aforementioned script will restore it.
|
2024-04-24 11:08:06 +03:00
|
|
|
nordvpn set autoconnect off
|
2024-05-10 18:35:07 +03:00
|
|
|
# Disconnects VPN
|
2024-04-20 07:40:34 +03:00
|
|
|
nordvpn disconnect
|
2024-05-10 18:35:07 +03:00
|
|
|
|
2024-07-30 07:46:36 +03:00
|
|
|
nordvpn set ipv6 on
|
|
|
|
nordvpn set notify on
|
|
|
|
nordvpn set lan-discovery on
|
|
|
|
|
2024-05-10 18:35:07 +03:00
|
|
|
# Explicitly restores IPv6 since NordVPN disables it by setting this to 1.
|
2024-05-10 18:17:37 +03:00
|
|
|
sudo sysctl net.ipv6.conf.all.disable_ipv6=0
|
2024-05-10 18:35:07 +03:00
|
|
|
|
2024-07-29 13:49:42 +03:00
|
|
|
# My scripts autostart them, I don't want NordVPN to haunt logs. However
|
|
|
|
# I have to change my mind since meshnet requires them.
|
|
|
|
#sudo systemctl stop nordvpnd.socket
|
|
|
|
#sudo systemctl stop nordvpnd.service
|
2024-05-10 18:35:07 +03:00
|
|
|
|
|
|
|
# Restarting networking ensures IPv6 connectivity will return.
|
2024-04-20 07:40:34 +03:00
|
|
|
sudo systemctl restart iwd.service
|
|
|
|
sudo systemctl restart systemd-networkd.service
|
2024-08-13 07:09:14 +03:00
|
|
|
sudo systemctl restart NetworkManager.service
|
2024-05-10 18:35:07 +03:00
|
|
|
|
|
|
|
# A bit of sleeping before flushing DNS caches, so we are surely connected
|
|
|
|
# for the new attempts. They are flushed in case of having private ECS aimed
|
|
|
|
# at the VPN.
|
2024-04-20 11:56:32 +03:00
|
|
|
sleep 5
|
2024-05-10 18:21:45 +03:00
|
|
|
#sudo systemctl restart unbound.service
|
|
|
|
sudo unbound-control reload
|
|
|
|
#sudo systemctl restart systemd-resolved.service
|
|
|
|
sudo resolvectl flush-caches
|
2024-05-10 18:31:26 +03:00
|
|
|
#sleep 5
|
2024-05-10 18:35:07 +03:00
|
|
|
|
|
|
|
# Yggdrasil needs IPv6
|
2024-04-27 12:20:05 +03:00
|
|
|
sudo systemctl restart yggdrasil.service
|
2024-05-10 18:35:07 +03:00
|
|
|
|
|
|
|
# The NTP server will now have access to IPv6 sources, possibly local NTP
|
|
|
|
# servers as well.
|
2024-04-20 11:56:32 +03:00
|
|
|
sudo chronyc online
|
2024-05-10 18:35:07 +03:00
|
|
|
|
|
|
|
# Tor will complain of IP address change and failing guards during
|
|
|
|
# disconnection.
|
2024-04-27 12:18:52 +03:00
|
|
|
sudo systemctl restart tor.service
|
2024-05-10 18:35:07 +03:00
|
|
|
|
2024-04-20 07:40:34 +03:00
|
|
|
set +x
|