Tutorial: creating a UFW Rule for DNS access from a specific IP

Configurare noua (How To)

Situatie

UFW (Uncomplicated Firewall) is a straightforward tool for managing firewall rules on Linux systems. If you want to allow DNS access only from a specific IP, you can do so by configuring a specific rule in UFW. Here’s how:

Step 1: Install UFW (if not already installed)

If you don’t already have UFW installed, you can do so using the following command in the terminal:

sudo apt install ufw

Step 2: Enable UFW

If UFW is not already enabled, you can do so using the command:

sudo ufw enable

Step 3: Adding a Rule for DNS Access

To allow DNS access only from a specific IP (let’s assume the IP address is 192.168.1.100), use the command:

sudo ufw allow from 192.168.1.100 to any port 53

This command allows traffic from the specified IP address to any destination on port 53, which is the standard port used for the DNS service.

Step 4: Checking the Added Rule

You can check the added rule using the command:

sudo ufw status

This will show you a list of all active UFW rules.

Step 5: Testing DNS Access

Finally, you can test whether the rule is working as intended. You can use a command such as nslookup or dig to test DNS access to an external DNS server from the specified IP address.

Make sure to replace the IP address specified in the command sudo ufw allow from 192.168.1.100 to any port 53 with the IP address you want to allow DNS access from. Also, verify and adjust any other settings or ports as per your specific needs.

Solutie

Tip solutie

Permanent

Voteaza

(10 din 15 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?