Wednesday, February 25, 2026
Wednesday, February 26, 2025
Script otomatis buat reset DNS di ubuntu 22.0.4
If FortiClient forces its DNS every time you connect, you can create a script that resets the DNS automatically after the VPN starts.
- Open the NetworkManager dispatcher directory:bash
sudo nano /etc/NetworkManager/dispatcher.d/99-reset-dns - Add the following script:bash
#!/bin/bash if [ "$2" = "up" ]; then nmcli con mod "WiFi-Connection-1" ipv4.dns "8.8.8.8 8.8.4.4" nmcli con up "WiFi-Connection-1" fi - Save the file (
CTRL + X, thenYandEnter). - Make it executable:bash
sudo chmod +x /etc/NetworkManager/dispatcher.d/99-reset-dns - Restart NetworkManager:bash
sudo systemctl restart NetworkManager
Now, every time you connect, this script will automatically override FortiClient’s DNS settings.
After making these changes, run:
bashnmcli con show "WiFi-Connection-1" | grep ipv4.dns
and
bashcat /etc/resolv.conf
to make sure your DNS settings are correctly applied.
Try:
bashnslookup google.com
or
bashping -c 4 google.com
to confirm if DNS is working.
Subscribe to:
Comments (Atom)