diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 5b27a2f4433..08f189b36f9 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -201,8 +201,18 @@ function postStartAction() ip link set dev ns-eth1"$NET_NS" netns "$NET_NS" ip netns exec "$NET_NS" ip link set ns-eth1"$NET_NS" name eth1 + if [[ -n "$lc_ip_offset" ]]; then + # Use ip offset provided by platform vendor via chassisdb.conf to prevent any conflict + # with any platform IP range, e.g., LC eth1-midplane IP. + ip_offset=$lc_ip_offset + else + # If Vendor has not provided an ip offset, Use 10 as default offset. Platform vendor should + # ensure there is no conflict with platform IP range for any slot. + ip_offset=10 + fi + # Configure IP address and enable eth1 - slot_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$slot_id.$(($DEV + 10)) + slot_ip_address=`echo $midplane_subnet | awk -F. '{print $1 "." $2}'`.$slot_id.$(($DEV + $ip_offset)) slot_subnet_mask=${midplane_subnet#*/} ip netns exec "$NET_NS" ip addr add $slot_ip_address/$slot_subnet_mask dev eth1 ip netns exec "$NET_NS" ip link set dev eth1 up