From 2606279aef9e6c11ed4da3586c8460b6c596e913 Mon Sep 17 00:00:00 2001 From: Hanwen Date: Fri, 20 Dec 2024 11:48:55 -0800 Subject: [PATCH] Raise priority of ParallelCluster configured route tables This commit fixes a bug from https://github.com/aws/aws-parallelcluster-cookbook/pull/2855, which made the route table/metric number larger (meaning lower priority). Thereafter, some unwanted default rules on AL2023 took priority and failed test_multiple_nics integration test on AL2023. This commit makes the number smaller (meaning higher priority) to fix the issue. e.g. Prior to this commit, the number for table for 1,1 is 1001001. After this commit, the number is 101+10=111. The "+10" is to properly handle table for 0,0, which has number 10. Without "+10", the table would conflict with table 0 from OS. FYI: the number of unwanted default AL2023 rule starts with 10101 Signed-off-by: Hanwen --- .../network_interfaces/configure_nw_interface.sh | 4 ++-- .../default/network_interfaces/configure_nw_interface.sh | 4 ++-- .../redhat-8.network_interfaces/configure_nw_interface.sh | 8 ++++---- .../rocky/network_interfaces/configure_nw_interface.sh | 8 ++++---- .../ubuntu/network_interfaces/configure_nw_interface.sh | 4 ++-- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh index bf42e6206..52b66cc36 100644 --- a/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh +++ b/cookbooks/aws-parallelcluster-environment/files/amazon-2023/network_interfaces/configure_nw_interface.sh @@ -24,8 +24,8 @@ fi cd "$configuration_directory" -SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%03d" $DEVICE_NUMBER) -ROUTE_TABLE=1${SUFFIX} +SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%02d" $DEVICE_NUMBER) +ROUTE_TABLE="$(( $SUFFIX + 10 ))" ln -s /usr/lib/systemd/network/80-ec2.network ${file_name} # Use default EC2 configuration. This include MTU, etc. diff --git a/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh index c2bd124e3..cfe0f5ed2 100644 --- a/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh +++ b/cookbooks/aws-parallelcluster-environment/files/default/network_interfaces/configure_nw_interface.sh @@ -21,9 +21,9 @@ then exit 1 fi -SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%03d" $DEVICE_NUMBER) +SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%02d" $DEVICE_NUMBER) -ROUTE_TABLE="1${SUFFIX}" +ROUTE_TABLE="$(( $SUFFIX + 10 ))" echo "Configuring device name: ${DEVICE_NAME} with IP:${DEVICE_IP_ADDRESS} CIDR_PREFIX:${CIDR_PREFIX_LENGTH} NETMASK:${NETMASK} GW:${GW_IP_ADDRESS} ROUTING_TABLE:${ROUTE_TABLE}" diff --git a/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh index c9a1bc95e..c74339319 100644 --- a/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh +++ b/cookbooks/aws-parallelcluster-environment/files/redhat-8.network_interfaces/configure_nw_interface.sh @@ -24,10 +24,10 @@ then fi con_name="System ${DEVICE_NAME}" -SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%03d" $DEVICE_NUMBER) -route_table="1${SUFFIX}" -priority="1${SUFFIX}" -metric="1${SUFFIX}" +SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%02d" $DEVICE_NUMBER) +route_table="$(( $SUFFIX + 10 ))" +priority="${route_table}" +metric="${route_table}" # Rename connection original_con_name=`nmcli -t -f GENERAL.CONNECTION device show ${DEVICE_NAME} | cut -f2 -d':'` diff --git a/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh index c9a1bc95e..c74339319 100644 --- a/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh +++ b/cookbooks/aws-parallelcluster-environment/files/rocky/network_interfaces/configure_nw_interface.sh @@ -24,10 +24,10 @@ then fi con_name="System ${DEVICE_NAME}" -SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%03d" $DEVICE_NUMBER) -route_table="1${SUFFIX}" -priority="1${SUFFIX}" -metric="1${SUFFIX}" +SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%02d" $DEVICE_NUMBER) +route_table="$(( $SUFFIX + 10 ))" +priority="${route_table}" +metric="${route_table}" # Rename connection original_con_name=`nmcli -t -f GENERAL.CONNECTION device show ${DEVICE_NAME} | cut -f2 -d':'` diff --git a/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh b/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh index f2fc909c9..f67450939 100644 --- a/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh +++ b/cookbooks/aws-parallelcluster-environment/files/ubuntu/network_interfaces/configure_nw_interface.sh @@ -41,8 +41,8 @@ if [ "${STATIC_IP_CONFIG}" = "" ] fi FILE="/etc/netplan/${DEVICE_NAME}.yaml" -SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%03d" $DEVICE_NUMBER) -ROUTE_TABLE="1${SUFFIX}" +SUFFIX=$(printf "%03d" $NETWORK_CARD_INDEX)$(printf "%02d" $DEVICE_NUMBER) +ROUTE_TABLE="$(( $SUFFIX + 10 ))" echo "Configuring ${DEVICE_NAME} with IP:${DEVICE_IP_ADDRESS} CIDR_PREFIX:${CIDR_PREFIX_LENGTH} NETMASK:${NETMASK} GW:${GW_IP_ADDRESS} ROUTING_TABLE:${ROUTE_TABLE}"