Commit e7ef3b58 authored by Deac Karns's avatar Deac Karns

add dnsmasq configuration feature

parent cf150e8c
......@@ -10,6 +10,7 @@ Vagrant.configure("2") do |config|
config.vbguest.auto_update = false
config.vm.provision "file", source: "./setupVars.conf", destination: "/home/vagrant/setupVars.conf"
config.vm.provision "file", source: "./dnsmasq.conf", destination: "/home/vagrant/dnsmasq.conf"
class Renew
def to_s
......@@ -40,7 +41,7 @@ Vagrant.configure("2") do |config|
mkdir -p /etc/pihole
IP=`/sbin/ifconfig enp0s8 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'`
sed -i "/IPV4_ADDRESS=/c\IPV4_ADDRESS=$IP" /home/vagrant/setupVars.conf
sed -i "s/{%IP%}/$IP/g" /home/vagrant/setupVars.conf
cp /home/vagrant/setupVars.conf /etc/pihole/setupVars.conf
curl -sSL https://install.pi-hole.net | bash /dev/stdin --unattended
......@@ -49,6 +50,27 @@ Vagrant.configure("2") do |config|
SHELL
class DnsMasq
def to_s
print "\n\nDo you want to reload dnsmask configs (y/n): "
STDIN.gets.chomp
end
end
config.vm.provision "shell", env: {"DNSMASQ" => DnsMasq.new}, inline: <<-SHELL
if [ $DNSMASQ == "y" ]; then
echo "Updating the dnsmasq configuration"
IP=`/sbin/ifconfig enp0s8 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'`
sed -i "s/{%IP%}/$IP/g" /home/vagrant/dnsmasq.conf
cp /home/vagrant/dnsmasq.conf /etc/dnsmasq.conf
pihole restartdns
fi
SHELL
config.vm.provision "shell", run: "always", inline: <<-SHELL
echo -n "\n\n\npihole can be reached at the following ip:\n"
/sbin/ifconfig enp0s8 | grep 'inet addr' | cut -d: -f2 | awk '{print $1}'
......
# Dont change this line
conf-dir=/etc/dnsmasq.d
# Dont change this line
address=/dns.pihole/{%IP%}
# Add local-only domains here, queries in these domains are answered
# from /etc/hosts or DHCP only.
local=/pihole/
# Add domains which you want to force to an IP address here.
# The example below send any host in example.net to a local
# ip address.
#address=/example.net/192.168.1.10
\ No newline at end of file
# Vagrant PiHole
# Vagrant Pi-hole
The purpose of this project is to make the [Pi-hole DNS ad blocker](https://pi-hole.net/) more accessible for daily use on any network.
Clone this repository
......@@ -24,26 +24,38 @@ your connected network.
## Switching Networks
Lets face it, you use more than one network if you use a laptop. In order to get the pihole
Lets face it, you use more than one network if you use a laptop. In order to get the Pi-hole
box to be on the same network as your laptop you will need to reconfigure the application each
time you switch networks.
This can be cumbersome and repetitive so it has been abstracted into a provisioning step. At any point,
you can re-provision the box to set up pihole and the vagrant box with the appropriate network settings.
you can re-provision the box to set up Pi-hole and the vagrant box with the appropriate network settings.
```
vagrant provision
```
## DNSMasq
**What is it?**
[dnsmasq](https://en.wikipedia.org/wiki/Dnsmasq) will allow you to create DNS records easily. Any record you add to the `dnsmasq.conf` file will be turned into a local DNS record after you provision the vagrant box.
## Begin Using PiHole
## Begin Using Pi-hole
Before you can take advantage of the pihole vagrant box you will need to tell your computer to use it as your DNS server.
Before you can take advantage of the Pi-hole vagrant box you will need to tell your computer to use it as your DNS server.
macOs:
Open `System Preferences` -> `Network`
click the `Advanced` button
add the ip address to the DNS section
\ No newline at end of file
add the ip address to the DNS section
## Pi-hole Admin panel
If you have properly configured your computers `dns` entry, you should be able to go to the following address to view the Pi-hole admin panel:
[http://dns.pihole/admin](http://dns.pihole/admin)
The password is `secret`...literally, its `secret`
\ No newline at end of file
......@@ -15,4 +15,4 @@ QUERY_LOGGING=true
INSTALL_WEB_SERVER=true
INSTALL_WEB_INTERFACE=true
LIGHTTPD_ENABLED=true
IPV4_ADDRESS=
\ No newline at end of file
IPV4_ADDRESS=%IP%
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment