# Pi-Hole VLAN advice using 05-custom.conf or define VLAN interfaces

**URL:** <https://discourse.pi-hole.net/t/pi-hole-vlan-advice-using-05-custom-conf-or-define-vlan-interfaces/38982>\
**Category:** Community Help\
**Created:** [October 3, 2020, 9:16am UTC](https://discourse.pi-hole.net/t/pi-hole-vlan-advice-using-05-custom-conf-or-define-vlan-interfaces/38982 "2020-10-03T09:16:35Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![deHakkelaar](https://discourse-cdn.pi-hole.net/user_avatar/discourse.pi-hole.net/dehakkelaar/32/674_2.png) [@deHakkelaar](https://discourse.pi-hole.net/u/deHakkelaar)\
**Post date:** [October 3, 2020, 7:35pm UTC](https://discourse.pi-hole.net/t/pi-hole-vlan-advice-using-05-custom-conf-or-define-vlan-interfaces/38982/3 "2020-10-03T19:35:47Z")

</div>

Vlan's are a switch thing.  
Clients and servers dont need to be aware what vlan's they are in.  
They only need to be aware of the subnets.  
There are some exceptions like hypervisors that apply virtual bridges etc for their guests/VM's that need to be in vlan trunks.  
I could be wrong missing some bits but am sure someone here will correct me 😉

To prevent having to route traffic between the subnets, you could assign all appropriate vlan's to the switch/router port that Pi-hole is connected to.  
And create a bunch of [aliased IP's](https://en.wikipedia.org/wiki/IP_aliasing) for each vlan on one and the same physical connected interface.  
Below how is done for Raspbian/Debian using `dhcpcd5` network manager (without having to translate that Dutch link):

```auto
pi@ph5:~ $ ip -br link show
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0 UP b8:27:eb:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>

```

* * *

```auto
pi@ph5:~ $ ip -br -4 address show
lo UNKNOWN 127.0.0.1/8
eth0 UP 10.0.0.4/24

```

* * *

```auto
pi@ph5:~ $ sudo nano /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto eth0.0
iface eth0.0 inet manual

auto eth0.1
iface eth0.1 inet manual

auto eth0.22
iface eth0.22 inet manual

```

* * *

```auto
pi@ph5:~ $ sudo service networking restart
pi@ph5:~ $

```

* * *

```auto
pi@ph5:~ $ ip -br l
lo UNKNOWN 00:00:00:00:00:00 <LOOPBACK,UP,LOWER_UP>
eth0 UP b8:27:eb:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>
eth0.0@eth0 UP b8:27:eb:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>
eth0.1@eth0 UP b8:27:eb:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>
eth0.22@eth0 UP b8:27:eb:xx:xx:xx <BROADCAST,MULTICAST,UP,LOWER_UP>

```

* * *

```auto
pi@ph5:~ $ sudo nano /etc/dhcpcd.conf
[..]
interface eth0
  static ip_address=10.0.0.4/24
  static routers=10.0.0.1
  static domain_name_servers=10.0.0.1

interface eth0.0
  static ip_address=10.10.10.10/24

interface eth0.1
  static ip_address=172.16.0.2/24

interface eth0.22
  static ip_address=192.168.0.2/24

```

* * *

```auto
pi@ph5:~ $ sudo service dhcpcd restart
pi@ph5:~ $

```

* * *

```auto
pi@ph5:~ $ ip -br -4 a
lo UNKNOWN 127.0.0.1/8
eth0 UP 10.0.0.4/24
eth0.0@eth0 UP 10.10.10.10/24
eth0.1@eth0 UP 172.16.0.2/24
eth0.22@eth0 UP 192.168.0.2/24

```

```auto
pi@ph5:~ $ ip -br -4 r
default via 10.0.0.1 dev eth0 src 10.0.0.4 metric 202
10.0.0.0/24 dev eth0 proto dhcp scope link src 10.0.0.4 metric 202
10.10.10.0/24 dev eth0.0 proto dhcp scope link src 10.10.10.10 metric 206
172.16.0.0/24 dev eth0.1 proto dhcp scope link src 172.16.0.2 metric 207
192.168.0.0/24 dev eth0.22 proto dhcp scope link src 192.168.0.2 metric 208

```

And make sure Pi-hole is set to "Listen on all interfaces" below:

[http://pi.hole/admin/settings.php?tab=dns](http://pi.hole/admin/settings.php?tab=dns)

EDIT: added routes

---

_[View the full topic](https://discourse.pi-hole.net/t/pi-hole-vlan-advice-using-05-custom-conf-or-define-vlan-interfaces/38982)._
