diff --git a/disable-dns-service/README.md b/disable-dns-service/README.md new file mode 100644 index 0000000..426632e --- /dev/null +++ b/disable-dns-service/README.md @@ -0,0 +1,33 @@ +## Why? + +This is a handy script to disable and stop systemd-resolved service. + +## How to use? + +```bash +bash -c "$(wget -qLO - https://raw.githubusercontent.com/bigbeartechworld/big-bear-scripts/master/disable-dns-service/disable_dns_service.sh)" +``` + +## How to troubleshoot? + +Check and see if port 53 is taken: + +```bash +lsof -i :53 +``` + +OR + +```bash +netstat -tulpn | grep ":53 " +``` + +Disable and stop the systemd-resolved service: + +```bash +sudo systemctl disable systemd-resolved.service +``` + +```bash +sudo systemctl stop systemd-resolved.service +``` diff --git a/disable-dns-service/disable_dns_service.sh b/disable-dns-service/disable_dns_service.sh new file mode 100644 index 0000000..bbaf833 --- /dev/null +++ b/disable-dns-service/disable_dns_service.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Check for root privileges +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root." + exit 1 +fi + +# Display open files using lsof or netstat +echo "List of processes with port 53 open:" +lsof -i :53 || netstat -tulpn | grep ":53 " + +# Disable and stop systemd-resolved service +echo "Disabling and stopping systemd-resolved service..." +systemctl disable systemd-resolved.service +systemctl stop systemd-resolved.service + +echo "Systemd-resolved service disabled and stopped."