Pi-Hole Docker Image on Raspberry Pi
- Flash your Raspbbery Pi with: Hypriot OS
- https://blog.hypriot.com/downloads/
- Boot the Raspberry, and login with The default credentials using PuTTY
- user: pirate
- password: hypriot.
- Run the following commands to disable the listener on port53
- sudo systemctl disable systemd-resolved.service
- sudo service systemd-resolved stop
- Run the following to install Pi-Hole:
- docker pull pihole/pihole
- Run the following to start Pi-Hole:
IP_LOOKUP="$(ip route get 8.8.8.8 | awk '{ print $NF; exit }')" # May not work for VPN / tun0IPv6_LOOKUP="$(ip -6 route get 2001:4860:4860::8888 | awk '{for(i=1;i<=NF;i++) if ($i=="src") print $(i+1)}')" # May not work for VPN / tun0 IP="${IP:-$IP_LOOKUP}" # use $IP, if set, otherwise IP_LOOKUP IPv6="${IPv6:-$IPv6_LOOKUP}" # use $IPv6, if set, otherwise IP_LOOKUP DOCKER_CONFIGS="$(pwd)" # Default of directory you run this from, update to where ever. echo "### Make sure your IPs are correct, hard code ServerIP ENV VARs if necessary\nIP: ${IP}\nIPv6: ${IPv6}" docker run -d \ --name pihole \ -p 53:53/tcp -p 53:53/udp \ -p 67:67/udp \ -p 80:80 \ -p 443:443 \ -v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \ -v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \ -e ServerIP="${IP}" \ -e ServerIPv6="${IPv6}" \ --restart=unless-stopped \ --cap-add=NET_ADMIN \ --dns=127.0.0.1 --dns=1.1.1.1 \ pihole/pihole:latest echo -n "Your password for https://${IP}/admin/ is " docker logs pihole 2> /dev/null | grep 'password'
Configure your hardware (router is recommended, had problems doing it on a windows 10 pc solely):
https://discourse.pi-hole.net/t/how-do-i-configure-my-devices-to-use-pi-hole-as-their-dns-server/245
- Static IP:
- enter command: sudo nano /etc/network/interfaces
- copy paste it a good place, save: # Static IP address
- run following command to restart network service: systemctl daemon-reload
- write_files:
- - content: |
- persistent
- # Generate Stable Private IPv6 Addresses instead of hardware based ones
- slaac private
- # static IP configuration:
- interface eth0
- static ip_address=192.168.1.31/24
- # static ip6_address=fd51:42f8:caae:d92e::ff/64
- static routers=192.168.1.1
- static domain_name_servers=192.168.1.1 8.8.8.8
- path: /etc/dhcpcd.conf
- #source: https://github.com/hypriot/flash/blob/master/sample/static.yml
- or you can reserve the address using your router:
- Pi's IP address: hostname -I
- Your router's IP address: ip route | grep default
- Change password: sudo docker exec -it [Container name of your pihole, e.g. pihole] pihole -a -p
- Access other pi commands from docker: sudo docker exec -it [Container name of your pihole, e.g. pihole] pihole [command key here]
- Reconfigure PiHole through UI - possibility to set static IP: sudo docker exec -it [Container name of your pihole, e.g. pihole] pihole -r
- The pi-hole will automatically restart on boot or in the event of a crash
- https://discourse.pi-hole.net/t/the-pihole-command-with-examples/738
- Access to change hostname of your pi in this file: sudo nano /boot/user-data
Other useful stuff:
type in the terminal:
Kommentarer
Send en kommentar