I have a small home server and I'd like programs on my laptop to be able to access it from both LAN and WAN. I think that the cleanest way to achieve this is to define a custom hostname and resolve it differently based on the network it's connected to.In other words, is it possible to resolve hostname X as ip address A if connected to network Foo, and as ip address B otherwise?I'm using Arch Linux and netctl as my network manager. I assume the way to achieve what I want is to set up hooks in the network profile for Foo to somehow change the hosts file, but I'm not sure on how to do the latter.Of course, I'd like to hear about better solutions, too.
How to resolve a hostname conditionally on the connected network?
networking;arch linux;hosts;netctl