aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.03k stars 323 forks source link

Instance registers the docker0 ip address #553

Open nunofernandes opened 6 months ago

nunofernandes commented 6 months ago

Hello,

We have an onprem server (rocky linux 8) with SSM agent (amazon-ssm-agent-3.2.2016.0-1.x86_64).

At AWS Fleet Manager we have that instance registered with the ip address from docker0 (172.17.0.1):

image

It was working fine until we lost the dhcp for a few hours and now even after restarting the SSM agent, I always get the docker0's IP registered.

If I do an ifconfig docker0 down; systemctl restart amazon-ssm-agent.service; ifconfig docker0 up it works (registers the correct ip) but after some time, it gets back to the previous docker0 ip address registered in SSM.

I think it's the code at agent/platform/platform.go that is sorting the interfaces differently (guessing):

    if interfaces, err = net.Interfaces(); err == nil {
        interfaces = filterInterface(interfaces)
        sort.Sort(byIndex(interfaces))
        candidates := make([]net.IP, 0)

What would be the best option here (except rebooting the server)?