Hostname alias for improved documentation

For discussion related to MythTV which doesn't belong in another forum.

Moderator: Forum Moderators

Post Reply
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Hostname alias for improved documentation

Post by PhilB »

The API documentation in the wiki has lots of examples such as:
or
My own backend is running Ubuntu and has a DHCP allocated address, but the router delivers a fixed address.
It occurs to me that if my own backend could have hostname aliases of BackendServerIP and FrontendIP then I could simply click any of the links and the examples would interrogate my own system.
Might this be possible? Any pointers appreciated.

Regards
Phil
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: Hostname alias for improved documentation

Post by daraden »

have you looked at the wsdl links in the web frontend?
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Hostname alias for improved documentation

Post by PhilB »

Yes - the wsdl interface gives a list of calling parameters and a list of returned parameters but real data is so revealing.
If the client system you are sat in front of is a linux one then I have found that you can add a line to its /etc/hosts like this:

Code: Select all

192.168.1.64  BackendServerIP
which works, but that leaves the Android, Windows etc systems in the house out in the cold. Linux rules again.
Phil
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: Hostname alias for improved documentation

Post by daraden »

could you explain
has a DHCP allocated address, but the router delivers a fixed address
you could setup a local DNS server, seems a little excessive given it's a simple copy and paste from the wsdl for most of the api get commands.
You could just bookmark the ones you use. This would allow you to have separate instances for each backend/frontend. instead of statically linking to a single backend/frontend. This also avoids having to dig through the wiki every time you want to check something. Most browsers have an import/export function, so transferring them to multiple systems should be easy.
Then there is the option to use the api to write a cross-platform program to access the data you want.
PhilB
Senior
Posts: 403
Joined: Sun May 11, 2014 6:23 pm
Great Britain

Re: Hostname alias for improved documentation

Post by PhilB »

could you explain
"has a DHCP allocated address, but the router delivers a fixed address"
Yes, all my devices use DHCP to get its IP address. Those which I want fixed (printer, mythtv server, NAS, pihole etc) are entered in a router table which maps mac address to IP addresses outside the normal DHCP range.
That was easier for me to set up at the time than climbing the learning curve of fixed addressing for those devices; also it's the same mechanism for all my devices and is all in one place.

Phil
luc5588
Junior
Posts: 39
Joined: Sat Dec 19, 2015 11:13 am
Reunion

Re: Hostname alias for improved documentation

Post by luc5588 »

DNS isn't too difficult to set up for a home network. I used to run dnsmasq which only requires one line for each host. You add a dhcp-host line giving MAC, IP address and hostname, and a separate file (defaults to /etc/hosts) to list any additional aliases for that host (such as BackendIP). Hosts without a specific entry are simply allocated from your dhcp pool.

Other options you may need to uncomment from the config file is dhcp-option=3 (to set the default router to your ADSL router) and the dhcp-range entry to say what pool range to allocate.

Then you need to set a static IP for you main server and disable dhcp on your router.

The dnsmasq reads /etc/resolv.conf to forward other dns requests to (presumably) your adsl router to forward to your ISP.

The advantage of your own dns server is that it's then easy to replace your router in the future without having to re-enter loads of host entries. The disadvantage is that the server needs to be on and booted first.

I no longer use dnsmasq since I migrated to a more complicated "proper" setup that gave no real benefits and never had time to switch back.
daraden
Senior
Posts: 175
Joined: Tue Feb 23, 2016 7:33 am
United States of America

Re: Hostname alias for improved documentation

Post by daraden »

since you are using pihole you should just have to add the alias to the dnsmasq config on the pihole system.
Post Reply