0

I am having issues finding the correct approach to take with my RPI setup. I have a router that does not let me disable DHCP and subsequently wont let me modify the DNS associated.

I would like all machines connected to my RPI via a switch connected to eth1 to use the same DNS.

What I have done so far? I am able to setup a bridge between eth0 and eth1 like so:

/etc/network/interfaces

auto eth0
iface eth0 inet manual

auto eth1
iface eth1 inet manual

auto br0
iface br0 inet manual

This effectively has let me create a bridge and provides the DHCP from the router over eth1 to all computers connected to the switch.

The problem now is that even if i set the dns in a static way of eth1,br0 or on eth0 it changes only for the RPI not for any computers connected to the switch on eth1.

For example:

auto eth0
iface eth0 inet static
address myrpiIP
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.1.254
dns-nameservers 0.0.0.0
dns-search local

Whilst the dns-nameserver works on the RPI itself, as mentioned all machines connected via eth1, irrelevant of if i define a nameserver for all interfaces seems to be served directly by the router:

For example on a windows machine connected to the switch connected to eth1:

 Default Gateway . . . . . . . . . :  192.168.1.254
 DHCP Server . . . . . . . . . . . : 192.168.1.254

here is a rough diagram, (minus the no connection part on the pc, as it now works):

enter image description here

Any help would be appreciated.

  • How about using the router to provide DHCP and manually putting the DNS in the interface details of each machine? A bit of a pain (esp with any guests) but it works around the issue. Other thought is to block DHCP and/or DNS requests to the router with ufw / iptables and use the Pi (even Pi-hole) to give you the control you are after. – Andyroo Apr 11 at 17:41
  • I do not completely understand your problem. How do you expect that the DNS server on the RasPi gets the mapping of ip address to device name? Do you manage it manual, or do you expect to have it automatically with dynamic DNS? – Ingo Apr 11 at 20:32
  • Hi, im managing them manually to the dns on the rpi to add the specific "PC" or services, for services not provided on the local network my dns uses an upstream. – D3181 Apr 11 at 20:36
  • You are using the DHCP server on the router. Do you always change the mapping on the DNS server if the DHCP server gives different ip addresses to the pcs? How do you detect changes? Please address me with @Ingo, otherwise I won't see your reply. – Ingo Apr 11 at 20:45
  • @Ingo my (plan) is that only the rpi itself uses the dhcp from the router - i would prefer either dhcp on the rpi to serve any connected machines on eth1 and override the dhcp and subsequently the dns of the router but im unsure how to achieve this – D3181 Apr 11 at 20:54
1

I will explain in short how a DHCP server works together with a DNS server to show what is possible for your problem. A network client requests an ip address from the DHCP server with its network name. So the DHCP server knows name and ip address of the client. It gives this information with DNS update records to the DNS server, but it must know what DNS server it has to inform. This is by configuration. If you cannot reconfigure this setup, you are lost with it.

Therefore I would completely separate from the DHCP server on the router and use an own DHCP server on your local network. Because DHCP server only work on broadcast domains (single or bridged subnets) there is no problem with conflicting of two DHCP server if you use routing. For example you can use subnet 192.168.1.0/24 on eth0 for the router and 192.168.2.0/24 on eth1 for your local network. Setup routing between these two interfaces is a well known task. Then you can install your own DHCP server and DNS server on the RasPi to serve on eth1 for your local network. dnsmasq is a good choice for this. It can do DHCP and DNS (and more) in one.

| improve this answer | |
  • After reading your response here and researching more how to achieve this i eventually found your old post raspberrypi.stackexchange.com/questions/98511/… and other than reversing eth0 and eth1, it was exactly what i needed. I now have it working with eth1 for the local network and all machines take the dns of the interface defined using systemd. thank you! – D3181 Apr 12 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.