bottlerocket-os / bottlerocket

An operating system designed for hosting containers
https://bottlerocket.dev
Other
8.78k stars 519 forks source link

No Automatic DHCP on secondary `eth1` interface for `aws-ecs-2` variant #3989

Open heri16 opened 5 months ago

heri16 commented 5 months ago

We are using the BottlerRocket AWS-ECS-2 variant to create a host with two ENIs (on different VPC subnets in order). Bottlerocket fails to detect other ENIs that has been attached. Anyway to solve this?

The problem seems to be with this line

I think this is a pretty common use case that could be added.

Related to #3394

Image I'm using:

Latest aws-ecs-2 variant bottlerocket-v1.20 (systemd-network)

What I expected to happen:

When an ENI is attached, bottlerocket could use udev or alike, to detect the new eth1 network interface and immediately tell netdog or systemd-network to enable DHCPv4 and DHCPv6 with RouteMetric=2048.

What actually happened:

ip link in sheltie, shows the eth1 interface. However, did not get a DHCP lease.

How to reproduce the problem:

Launch a new AWS EC2 instance with bottlerocket-v1.20 aws-ecs-2 AMI. Then attach a new secondary ENI to the EC2 instance.

Use AWS SSM session to run these commands:

# Notice that eth1 does not show up on `ip addr` and `networkctl status`.
ip link
ip addr
networkctl status

# Configure eth1 manually (without netdog)
cat <<EOF > /etc/systemd/network/11-eth1.network
[Match]
Name=eth1
[Link]
RequiredForOnline=false
RequiredFamilyForOnline=ipv4
[Network]
DHCP=yes
IPv6AcceptRA=true
IPv6DuplicateAddressDetection=0
KeepConfiguration=dhcp
[DHCPv4]
UseMTU=true
RouteMetric=2048
[DHCPv6]
WithoutRA=solicit
[IPv6AcceptRA]
UseMTU=true
RouteMetric=2048
EOF

systemctl reload systemd-networkd

networkctl status

ip route
ip -6 route
ytsssun commented 5 months ago

Hi @heri16, thanks for opening this issue. We are aware of the issue with multi-network-card case. For k8s variants Bottlerocket rely on k8s VPC CNI to manage ENIs. However, we do not have equivalent for ECS variants today.

We are also re-inventing our way for the overall multi-network-cards management for Bottlerocket. We cannot a provide a date yet, but this is on our plate.