-
Notifications
You must be signed in to change notification settings - Fork 342
Open
Description
As part of the domain join script for Unix, there is a line where we get the interface IP address, but the interface name is hard-coded (eth0
) as you can see here:
ip_address="$(ip -o -4 addr show eth0 | awk '{print $4}' | cut -d/ -f1)" |
Although this works for t2
instance types, it doesn't work for t3
and t3a
since the network interface name has changed to ensX
.
I suggest to change this line to dynamically fetch the the IP without specifying the interface name.
There are 2 options to do this:
# Option 1:
ip_address="$(hostname -I)"
# Option 2:
ip_address="$(ip -o -4 addr show $(ip route list | grep default | grep -E 'dev (\w+)' -o | awk '{print $2}') | awk '{print $4}' | cut -d/ -f1)"
This is an important fix as there is currently an issue with this script when running on newer machine types
jaseblenner
Metadata
Metadata
Assignees
Labels
No labels