You are not logged in.

#1 2021-08-01 11:39:54

leonixyz
Member
Registered: 2014-07-12
Posts: 64

Resolve a FQDN with different IP addresses depending on network

Hi,

my laptop uses netctl for networking and stubby as local DNS resolver.

I would like to resolve a specific FQDN differently, depending on what network I am connected to.


For example:

- When I'm connecting from home, I want to resolve it with 10.10.10.10
- When I'm connecting from the office, I want to resolve it with 192.168.10.10
- In all other cases, I want to resolve it with its public IP address, as returned by stubby

The only way I can think to do it, is to create a custom script and execute it as a netctl hook. This would require my script to dynamically edit /etc/hosts, as I don't know any other ways to temporarily set a static host definition.

Are there other ways to do it? My solution does not seem robust enough.

Thanks in advance

Last edited by leonixyz (2021-08-01 11:47:04)

Offline

Board footer

Powered by FluxBB