You are not logged in.

#1 2018-01-14 22:24:35

silvrax
Member
Registered: 2012-08-21
Posts: 12

systemd-resolved, resolving single-label name via routing-only server

I've been trying to setup my system with systemd-networkd and systemd-resolved. The system has two relevant network interfaces. A wired interface, lan0, and a VPN interface tun0. The lan0 interface is connected to my local network, which has mynet.lan as it's domain name. It has a name server running at 1.1.1.1. The tun0 interface is connected to my company's network, which has office.lan as it's domain name. It has a name server running at 2.2.2.2. I would like name resolution to work as follows:

Single-label names should first be attempted as <name>.mynet.lan via 1.1.1.1, then as <name>.office.lan via 2.2.2.2.
Full names ending in mynet.lan should always be resolved via 1.1.1.1.
Full names ending in office.lan should always be resolved via 2.2.2.2.
All other names should only be resolved via 1.1.1.1, never via 2.2.2.2.

In other words, I want to resolve stuff on the internet, and stuff in my local network, via my local name server. And company names via the company name server. And search both for single-label names.

So far I've been stuck on two different setups, which both get close, but not quite there yet. In both setups I have the following output for lan0, from systemd-resolve --status: (removed some irrelevant lines)

Link 2 (lan0)
DNS servers 1.1.1.1
DNS domain mynet.lan

I first tried with the company network setup as a route-only domain on the tun0 interface:

Link 4 (tun0)
DNS servers 2.2.2.2
DNS domain ~office.lan

In this case, my local network names work, both full names as well as single-label names. Internet names are resolved via the correct (local) server. And only full company names are resolved via the company server. The problem in this case, is that single-label names are never attempted in the office.lan domain, so I always have to use full names when accessing company stuff.

The second attempt is with the following for the tun0 interface:

Link 4 (tun0)
DNS servers 2.2.2.2
DNS domain office.lan

In this case, single-label names are attempted in both domains, which is good. However, the problem with this setup, is that internet names are also attempted via both servers, which is not what I want.

So I guess what I want is the first setup, with the office.lan as a routing-only domain, but also include it in the search list. However I can't seem to configure that.

Is this at all possible with systemd-resolved? I'm a bit stuck now. In the past I've been able to achieve the desired behavior via a local dnsmasq instance on my machine, but I'd really like to know if this can also be done via systemd-resolved.

Any tips, hints or things I would need to clarify further?

Thanks!

Offline

Board footer

Powered by FluxBB