Closed nefnohack closed 1 year ago
Hi @nefnohack. The issue here is that the VPC DHCP server sends sends the provided list of domains using DHCP option 15, which only supports a single domain name (see RFC 2132 section 3.17). When multiple domain names are provided, they're separated by a space character, which isn't valid in a domain name, so systemd-resolved replaces the space with a decimal encoding of the ascii value.
This has been observed elsewhere as well, and this CoreOS issue provides a good summary including packet captures.
The awscli documentation has the following to say on the topic:
Important : Some Linux operating systems accept multiple domain names separated by spaces. However, Windows and other Linux operating systems treat the value as a single domain, which results in unexpected behavior. If your DHCP options set is associated with a VPC that has instances with multiple operating systems, specify only one domain name.
So for now, our recommendation is to follow that documentation and specify a single domain name in your DHCP option sets.
We've passed on the request to the VPC team to add full support for multiple domain names using DHCP Option 119 ([RFC 3397, section 2) but don't have an estimate about when such support might be available.
but other linux system like amazonlinux 2 and redhat donot have this issue
but other linux system like amazonlinux 2 and redhat donot have this issue
@nefnohack Right, consider it something of an "accidental feature" of these other distros and their DHCP client implementations. The systems where this appears to work aren't doing any validation of the data received from the DHCP server. The end result is that the invalid character is passed through and rendered in the resolv.conf file directly, and happens to be what you want to see. The systems where this experiences problems are validating the data from the DHCP server and correctly identifying that a space character is invalid in a domain and are escaping it.
There's been a section added to our documentation on this: https://docs.aws.amazon.com/linux/al2023/ug/deprecated-al2.html#dhcp-set-domain-name-space
Describe the bug Use AWS DHCP Options set domain-name separated by "032" rather than a space
To Reproduce
Expected behavior the content for /etc/resolv.conf should be(search test1.com test2.com) but it shows below: search test1.com032test2.com
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context Add any other context about the problem here.