Giter Club home page Giter Club logo

opnsense-vpn-dns's Introduction

opnsense-vpn-dns

Problem: opnsense does not honor "dhcp-option DNS" and therefore does not change the System DNS Servers to the one of your VPN Provider by default. If this is wrong and you know how to do this with just the WebGUI please tell me ๐Ÿ˜„

Solution:

Basic usage

Adds the IP4 address of the DNS Servers that are pushed by the OpenVPN Server (VPN Provider) to the client (opnsense).

This is part of the PUSH line found in /var/log/openvpn.log

dhcp-option DNS 95.211.146.77,dhcp-option DNS 37.48.94.55

The script will make the local DNS Resolver unbound use those servers as new forwarding servers for DNS lookups.

To see what Nameserver a currently in use run this script with show argument

root@opnsense:~ # ./vpn-dns.sh show
The following name servers are used for lookup of opnsense.org.
forwarding request:
Delegation with 0 names, of which 0 can be examined to query further addresses.
It provides 2 IP addresses.
37.48.94.55             rto 60 msec, ttl 304, ping 36 var 6 rtt 60, tA 0, tAAAA 0, tother 0, EDNS 0 probed.
95.211.146.77           rto 51 msec, ttl 304, ping 35 var 4 rtt 51, tA 0, tAAAA 0, tother 0, EDNS 0 probed.

or

unbound-control -c /var/unbound/unbound.conf lookup opnsense.org

Restores the DNS Servers from /etc/resolv.conf with

./vpn-dns.sh del

Installation

SSH Login to your opnsense and fetch this script

fetch https://raw.githubusercontent.com/ddowse/opnsense-vpn-dns/main/vpn-dns.sh 
chmod u+x vpn-dns.sh

Open the VPN Settings in opnsense WebGUI and go to the client. Scroll down to the advanced configuration
field and add the lines

up "/root/vpn-dns.sh add"
down "/root/vpn-dns.sh del"

Make sure that verbosity is at least at Level 3.

If you choose to save the file somewhere else then don't forget to modify the path to the script.

Deinstall/Disable

Deinstall: Delete the lines and delete the file from opnsense
Disable: Add # in beginning of the lines.

Change /Forwarding/ DNS Server 'on-the-fly'

Just an example.

./vpn-dns.sh put 88.198.92.222 1.1.1.1 9.9.9.9

This would just execute

unbound-control -c /var/unbound/unbound.conf forward_add +i . 88.198.92.222 1.1.1.1 9.9.9.9

opnsense-vpn-dns's People

Contributors

ddowse avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.