bottlerocket-os / bottlerocket-os/bottlerocket-core-kit

Send "Hostname" when creating a DHCP request

Open
#417 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
34
Forks
77
Avg merge
2d 23h
Merged PRs (30d)
23

Description

**What I'd like:**
- When using Bottlerocket, hostname is not sent as part of the DHCP request.
- From within Bottlerocket, we can look at the DHCP request using tcpdump, and restart wickerd nanny process to force wickerd to renew the lease (restarting wickerd itself restarted the network as well which stopped the tcpdump, hence restarting nanny process instead). tcpdump can be run from admin container, and wickerd nanny can be restarted from `sheltie`.
- Looking at the output, hostname is not sent in DHCP request:
```
bash-5.1# systemctl restart wickedd-nanny.service
```

```
[root@admin]# tcpdump -v -i any port 67 or 68
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
09:09:32.821373 IP (tos 0x10, ttl 64, id 0, offset 0, flags [DF], proto UDP (17), length 328)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 06:3a:7e:10:33:f7 (oui Unknown), length 300, xid 0x32192aa8, Flags [none]
Client-Ethernet-Address 06:3a:7e:10:33:f7 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Request
Client-ID Option 61, length 19: hardware-type 255, 7e:10:33:f7:00:01:00:01:2a:d7:d3:d4:06:3a:7e:10:33:f7
Requested-IP Option 50, length 4: ip-192-168-29-176.eu-west-1.compute.internal
Parameter-Request Option 55, length 20:
RN, RB, Subnet-Mask, BR
MTU, Classless-Static-Route, Default-Gateway, Static-Route
Option 119, Domain-Name, Domain-Name-Server, YD
YS, NTP, RP, Option 85
Option 86, Option 87, POSIX-TZ, TZ-Name
MSZ Option 57, length 2: 9001
```

For comparison, the same test was run on Ubuntu using dhclient, and the below output is received:
```
07:37:52.161055 IP (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 0a:38:32:37:4b:e7 (oui Unknown), length 300, xid 0x29f71603, Flags [none]
Client-Ethernet-Address 0a:38:32:37:4b:e7 (oui Unknown)
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message (53), length 1: Request
Requested-IP (50), length 4: ip-172-31-39-230.eu-west-1.compute.internal
Hostname (12), length 16: "ip-172-31-39-230"
Parameter-Request (55), length 13:
Subnet-Mask (1), BR (28), Time-Zone (2), Default-Gateway (3)
Domain-Name (15), Domain-Name-Server (6), Unknown (119), Hostname (12)
Netbios-Name-Server (44), Netbios-Scope (47), MTU (26), Classless-Static-Route (121)
NTP (42)
```

- In the above, DHCP option 12 (hostname) is present when DHCP is done on Ubuntu, but not on Bottlerocket.

- Some research into wicked suggests that setting `DHCLIENT_HOSTNAME_OPTION` may work:
https://github.com/openSUSE/wicked/blob/master/client/suse/config/sysconfig.dhcp-wicked

> \# Default is to use the FQDN option, when the DHCLIENT_HOSTNAME_OPTION
> \# variable is set to a full hostname, that is, when it contains a dot.
> \# When DHCLIENT_HOSTNAME_OPTION is set to AUTO, short hostname from
> \# /etc/hostname is send via hostname option 12 (same as SLES-11).

- However, this is part of a set of “ifcfg”-style configuration options allowed by wicked. To my knowledge Bottlerocket does not implement these configuration files, nor does it allow for use of the provided options.

- Can we look at modifying the DHCP process on Bottlerocket to send the hostname, or provide a setting/option to enable this?

**Use-case:**

- This fits a custom DHCP setup where IP addess range is grouped and assigned by hostname

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.