mirror of
https://github.com/bigbeartechworld/big-bear-scripts.git
synced 2026-07-05 21:32:09 -04:00
Add the script to disable DNS on Ubuntu
This commit is contained in:
33
disable-dns-service/README.md
Normal file
33
disable-dns-service/README.md
Normal 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
|
||||
```
|
||||
18
disable-dns-service/disable_dns_service.sh
Normal file
18
disable-dns-service/disable_dns_service.sh
Normal 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."
|
||||
Reference in New Issue
Block a user