Add the script to disable DNS on Ubuntu

This commit is contained in:
Christopher
2023-08-24 14:14:57 -05:00
parent a114fc6587
commit 4eb30b366d
2 changed files with 51 additions and 0 deletions

View File

@@ -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
```

View File

@@ -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."