Please follow the below template, it will help us to help you!
Hello, thanks for reading my question.
I was wondering if I can install Pi-hole on my existing Web server pi.
I read this blog, and it seems like it is possible to place pi-hole as primary static IP and web server as a secondary IP (vice versa too but seems like I needed to install pi-hole first). Because my pi's static ip is already configured to use Web Server. I am wondering if I can still set up Pi-hole after I already define pi's primary ip.
Here is my primary and secondary ip and I am running the web server with the primary:
Yes you can depending on what other web daemon you have running now ?
Looks like the blogger is not taking into account that Pi-hole will install the dhcpcd5 software package that deals with network settings and applying them.
Configuring the /etc/network/interfaces file manually will conflict with dhcpcd5:
pi@noads:~ $ apt show dhcpcd5
[..]
Description: DHCPv4, IPv6RA and DHCPv6 client with IPv4LL support
dhcpcd is a one stop network management daemon which includes
* RFC compliant DHCPv4 and DHCPv6 clients
* DHCPv6 Prefix Delegation support
* IPv4LL (aka ZeroConf) support
* ARP address conflict resolution
* Link carrier detection
* Wireless SSID profiles
* ARP ping profiles
After Pi-hole is installed better use IP aliasing like below that will give you an additional virtual interface eth0.0 :
pi@noads:~ $ cat /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 lo
iface lo inet loopback
iface eth0 inet manual
auto eth0.0
iface eth0.0 inet manual
pi@noads:~ $ sudo service networking restart
pi@noads:~ $
pi@noads:~ $ ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
inet 10.0.0.2/24 brd 10.0.0.255 scope global eth0
valid_lft forever preferred_lft forever
3: eth0.0@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 192.168.1.99/24 brd 192.168.1.255 scope global eth0.0
valid_lft forever preferred_lft forever
pi@noads:~ $ ip -4 r
default via 10.0.0.1 dev eth0 src 10.0.0.2 metric 202
10.0.0.0/24 dev eth0 proto kernel scope link src 10.0.0.2 metric 202
192.168.1.0/24 dev eth0.0 proto kernel scope link src 192.168.1.99 metric 203
The two IP addresses are residing in different subnets 192.168.1.0/24 and 192.168.4.0/24.
A device living in the 192.168.1.0/24 subnet wont be able to communicate with devices in the 192.168.4.0/24 subnet without a router between them.
If lucky and not having a misconfigured network (like no default gateway or routes), try run below one first:
echo 'nameserver 8.8.8.8' | sudo tee /etc/resolv.conf