Skip to content

Commit

Permalink
Match primary ENI IP correctly
Browse files Browse the repository at this point in the history
Fixes #1246
  • Loading branch information
Claes Mogren authored and jayanthvn committed Oct 7, 2020
1 parent 59cd4ae commit 11f82f9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ done
echo "Configure rp_filter loose... "
TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60")
HOST_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4)
PRIMARY_IF=$(ip -4 -o a | grep "$HOST_IP" | awk '{print $2}')
PRIMARY_IF=$(ip -4 -o a | grep "$HOST_IP/" | awk '{print $2}')
sysctl -w "net.ipv4.conf.$PRIMARY_IF.rp_filter=2"
cat "/proc/sys/net/ipv4/conf/$PRIMARY_IF/rp_filter"

Expand Down

0 comments on commit 11f82f9

Please sign in to comment.