Alias Hostname for Openhab Server

Hi OH Fans,

Disclaimer: i know, my question is not OH related at all, but somehow i googled and seem to miss the right keyword. I put all my hopes into the tech knowhow of this great board :slight_smile:

Situation:
If have a FritzBox Cable as Router (and DNS server and “everything”) behind that i run a NUC with unbuntu called “openhab” as servername. I run openhab and several other things (nginx, monitorix) in docker there, having nginx as reverse proxy

However, since i called my server “openhab”, i have to configure my nginx reverse proxy to sub locations ( like /monitorix/)

I wish i could just have http://monitorix as a virtual host. NGINX wise, no problem.

Question:
But how do i tell the DNS on the FritzBox to resolv “monitorix” to the openhab server as well?

Real Usecase:
In case you find http://openab/monitorix pretty decent, since it is the monitorix for OH. True. My other usacase is, that i consider running squidguard as a proxy server. Doing so, i would want to autoconfig the proxy settings of all devices around. Fot that i would need WPAD as a servername to deliver autoconfigto the client. Renaming openhab to wpad is not wanted…

Best
Michael

You need to bind multiple IP-Addresse to your network interface, instructions can be found here


Next step is adding different hostnames to the IP‘s.
After this, you should be able to configure NGINX to redirect the different Addresses to your sevices.

Hi Hans-Jörg,

i was not even aware, that this is possible! Thanks a lot for pointing this out, sounds like a very possible solution!!!

Best
Michael

Hmm - to add a second ip to the interface works easily. Unfortunately the FritzBox does not recognize that IP as diefferent device, so i could name it properly :frowning:.

Yes, i could take away the dhcp & dns topic fro the fritzbox, but that is some effort i want to avoid, since i add to many new single points of failure to my setup :-/

You don‘t need to change your FritzBox settings, just add the new IP‘s and names to your /etc/hostname file

Hmm, this is possible? I googled a bit and tried the notion

IP name
ip2 name2

for etc/hosts - no effect.

Afterwards i tried to use the hostname statement in the etc/network/interfaces.

Bad Idea. PC is headless and wall mounted in the basement. :blush:. Took some minutes to fix.

However, accordign to interfaces man page, my config was correct. Hmmm.

I’ll try on.

I know that I am not helping… but I would recommend deploying DNS & DHCP for your LAN on the Linux host running OH2 :slight_smile: It’s not too hard and if you don’t want to mess with config files, take a look at webmin.

You can then add aliases on the DNS to point to the OH2 IP Address.

I don’t think that you can do much with the FritzBox DNS.

even if you succeed with this, this would apply only to the local linux host name resolutions. You won’t be able to resolve the extra aliases from another host on your LAN.

Hi, Angelos, do you have a guide you can recommend?

I did this some time ago. Installing dnsmasq is pretty straight forward. I can lookup some essential configuration tomorrow if it is of interest.

I have never looked back to the limited dns or dhcp of the fritzbox.

Most of the times, I use the debian wiki:
https://wiki.debian.org/Bind9
https://wiki.debian.org/DHCP_Server

For packages, I go with ISC: dhcp & bind (apt-get installations as per wiki)

when I am too lazy, I use Webmin for configurations :slight_smile:

1 Like

@Dim well true, but then essentially all of my network would rely on the linux box to be up. Thats something i intended to avoid.

Is there a chance, to install an DNS on my server, but let FritzBox ask by server as “external” DNS?

I am not sure that I got it…
You could setup your DHCP to assign both hosts (Linux + Fritz) for DNS entries (Linux primary and Fritz secondary) to the LAN clients. If NUC goes down, you will still be able to access the interweb (but won’t be able to resolve the custom aliases).

correct… but usually a linux (NUC) box is very reliable (and highly configurable). In theory, you would be running it 24/7 anyway.

@Dim , i meant something more complic<ted; but you are simply right. In both points. :slight_smile:

1 Like