thedocks/pihole/readme.md

45 lines
841 B
Markdown
Raw Normal View History

2021-11-12 23:14:52 +00:00
# Pi Hole
2021-11-14 12:00:12 +00:00
## Create docker network
```
docker network create -d macvlan \
2022-03-12 15:46:10 +00:00
--subnet=192.168.1.5/24 --gateway=192.168.1.1 \
2021-11-14 12:00:12 +00:00
--ip-range 192.168.1.59/28 \
-o parent=eth0 \
--aux-address="myserver=192.168.1.60" \
macvlan0
```
then
2022-03-17 22:02:38 +00:00
```
sudo ip link set eth0 promisc on
sudo ip link add macvlan-shim link eth0 type macvlan mode bridge
sudo ip addr add 192.168.1.60/28 dev macvlan-shim
sudo ip link set macvlan-shim up
```
2021-11-14 12:00:12 +00:00
Check
2022-03-17 22:02:38 +00:00
`ifconfig macvlan-shim`
2021-11-14 12:00:12 +00:00
## /usr/local/bin/pi-vlan.sh
```
#!/usr/bin/env bash
ip link add macvlan-shim link eth0 type macvlan mode bridge
ip addr add 192.168.1.60/28 dev macvlan-shim
ip link set macvlan-shim up
ifconfig macvlan-shim
```
## /etc/systemd/system/pi-vlan.service
```
[Unit]
After=network.target
[Service]
ExecStart=/usr/local/bin/pi-vlan.sh
[Install]
WantedBy=default.target
```