Support nexthop_gateway in IPv6
Re-add support for nexthop_gateway in IPv6 configurations in Debian. Ensure the translated nexthop_gateway boot parameter is applied to IPv6 network configurations. These changes are applied to both the pre-ostree-pull network configuration (via 'ip' command), and the /etc/network/interfaces.d ifupdown interface configuration. Test Plan PASS: - Test IPv6 install using only nexthop_gateway value - With and without bootstrap_vlan - Ensure that the default route is created, via the given nexthop_gateway - Validate successful ostree repo pull - Ensure that the default route is created via the - /etc/network/interfaces.d upon reboot into the ostree repo - Validate that communications are established to subcloud, ready for ansible bootstrap - Test IPv6 install using no nexthop_gateway value - With and without bootstrap_vlan - Verify that default route is created, with no gateway - Test IPv4 install using only nexthop_gateway value - With and without bootstrap_vlan - Ensure that the default route is created, via the given nexthop_gateway - Full install plus bootstrap, as above - Tested in libvirt - Test IPv4 install using no nexthop_gateway value - With and without bootstrap_vlan - Verify that default route is created, with no gateway - Full install plus bootstrap, as above - Tested in libvirt Closes-Bug: 2017007 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com> Change-Id: Iee71f753983fa77ad396a6a90e2f6cec189cbaa8 Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
This commit is contained in:
parent
f7e1be7d78
commit
8be0edb971
@ -673,26 +673,30 @@ function parse_miniboot_network_params()
|
|||||||
{
|
{
|
||||||
BOOTPARAM_MGMT_ADDRESS_FAMILY=
|
BOOTPARAM_MGMT_ADDRESS_FAMILY=
|
||||||
BOOTPARAM_IP_ADDR=
|
BOOTPARAM_IP_ADDR=
|
||||||
BOOTPARAM_VLAN=0
|
BOOTPARAM_VLAN=
|
||||||
BOOTPARAM_GW=
|
BOOTPARAM_GW=
|
||||||
BOOTPARAM_PREFIX_LEN=
|
BOOTPARAM_PREFIX_LEN=
|
||||||
BOOTPARAM_IFNAME=
|
BOOTPARAM_IFNAME=
|
||||||
BOOTPARAM_IP_VER=
|
BOOTPARAM_IP_VER=
|
||||||
BOOTPARAM_ROUTE_OPTIONS=
|
|
||||||
BOOTPARAM_METRIC=
|
BOOTPARAM_METRIC=
|
||||||
BOOTPARAM_DNS=
|
BOOTPARAM_DNS=
|
||||||
|
|
||||||
# Pull out the ip= line from /proc/cmdline:
|
# Parse values from /proc/cmdline
|
||||||
local ipstring
|
local ipstring=
|
||||||
|
local vlan=
|
||||||
for arg in \$(cat /proc/cmdline); do
|
for arg in \$(cat /proc/cmdline); do
|
||||||
case "\$arg" in
|
case "\${arg}" in
|
||||||
ip=*)
|
ip=*)
|
||||||
ipstring=\${arg:3}
|
ipstring=\${arg:3}
|
||||||
ilog "Using ip=\$ipstring"
|
ilog "Using ip=\$ipstring"
|
||||||
break
|
;;
|
||||||
|
vlan=*)
|
||||||
|
vlan=\${arg:5}
|
||||||
|
ilog "Using vlan=\${vlan}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
ilog "Parsing boot ipstring=\$ipstring"
|
ilog "Parsing boot ipstring=\$ipstring"
|
||||||
|
|
||||||
# Now we have a string like:
|
# Now we have a string like:
|
||||||
@ -704,7 +708,7 @@ function parse_miniboot_network_params()
|
|||||||
# [2620:10a:a001:d41::212],,,64,subcloud3,ens1f0.401,none (for ipv6)
|
# [2620:10a:a001:d41::212],,,64,subcloud3,ens1f0.401,none (for ipv6)
|
||||||
|
|
||||||
BOOTPARAM_IP_ADDR=\$(echo \$ipstring | awk -F',' '{print \$1}' | tr -d '\[\]')
|
BOOTPARAM_IP_ADDR=\$(echo \$ipstring | awk -F',' '{print \$1}' | tr -d '\[\]')
|
||||||
BOOTPARAM_GW=\$(echo \$ipstring | awk -F',' '{print \$3}')
|
BOOTPARAM_GW=\$(echo \$ipstring | awk -F',' '{print \$3}' | tr -d '\[\]')
|
||||||
BOOTPARAM_PREFIX_LEN=\$(echo \$ipstring | awk -F',' '{print \$4}')
|
BOOTPARAM_PREFIX_LEN=\$(echo \$ipstring | awk -F',' '{print \$4}')
|
||||||
hostname=\$(echo \$ipstring | awk -F',' '{print \$5}')
|
hostname=\$(echo \$ipstring | awk -F',' '{print \$5}')
|
||||||
BOOTPARAM_IFNAME=\$(echo \$ipstring | awk -F',' '{print \$6}')
|
BOOTPARAM_IFNAME=\$(echo \$ipstring | awk -F',' '{print \$6}')
|
||||||
@ -720,22 +724,9 @@ function parse_miniboot_network_params()
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
BOOTPARAM_MGMT_ADDRESS_FAMILY="inet"
|
BOOTPARAM_MGMT_ADDRESS_FAMILY="inet"
|
||||||
BOOTPARAM_ROUTE_OPTIONS="via \$BOOTPARAM_GW"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Parse the vlan= line from /proc/cmdline (if it exists):
|
|
||||||
local vlan=
|
|
||||||
for arg in \$(cat /proc/cmdline); do
|
|
||||||
case "\${arg}" in
|
|
||||||
vlan=*)
|
|
||||||
vlan=\${arg:5}
|
|
||||||
ilog "Parsing vlan=\${vlan}"
|
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -n "\${vlan}" ]; then
|
if [ -n "\${vlan}" ]; then
|
||||||
# Parameter format: "bootstrap_interface.bootstrap_vlan:bootstrap_interface"
|
# Parameter format: "bootstrap_interface.bootstrap_vlan:bootstrap_interface"
|
||||||
dlog "Parsing vlan from \${vlan}"
|
dlog "Parsing vlan from \${vlan}"
|
||||||
@ -746,11 +737,14 @@ function parse_miniboot_network_params()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
logmsg="Using IP values: ip:\$BOOTPARAM_IP_ADDR, family: \$BOOTPARAM_MGMT_ADDRESS_FAMILY"
|
logmsg="Using IP values: ip:\$BOOTPARAM_IP_ADDR, family: \$BOOTPARAM_MGMT_ADDRESS_FAMILY"
|
||||||
if [ "\$BOOTPARAM_VLAN" -ne 0 ]; then
|
if [ -n "\$BOOTPARAM_VLAN" ]; then
|
||||||
logmsg="\$logmsg vlan: \$BOOTPARAM_VLAN, "
|
logmsg="\$logmsg vlan: \$BOOTPARAM_VLAN, "
|
||||||
fi
|
fi
|
||||||
logmsg="\$logmsg prefix:\$BOOTPARAM_PREFIX_LEN, gw:\$BOOTPARAM_GW, ifname: \$BOOTPARAM_IFNAME, "
|
logmsg="\$logmsg prefix:\$BOOTPARAM_PREFIX_LEN, ifname: \$BOOTPARAM_IFNAME, "
|
||||||
logmsg="\$logmsg route options: \$BOOTPARAM_ROUTE_OPTIONS, metric: \$BOOTPARAM_METRIC, dns: \$BOOTPARAM_DNS"
|
if [ -n "\${BOOTPARAM_GW}" ]; then
|
||||||
|
logmsg="\$logmsg gw:\$BOOTPARAM_GW, "
|
||||||
|
fi
|
||||||
|
logmsg="\$logmsg metric: \$BOOTPARAM_METRIC, dns: \$BOOTPARAM_DNS"
|
||||||
ilog "\$logmsg"
|
ilog "\$logmsg"
|
||||||
|
|
||||||
export BOOTPARAM_MGMT_ADDRESS_FAMILY
|
export BOOTPARAM_MGMT_ADDRESS_FAMILY
|
||||||
@ -760,7 +754,6 @@ function parse_miniboot_network_params()
|
|||||||
export BOOTPARAM_PREFIX_LEN
|
export BOOTPARAM_PREFIX_LEN
|
||||||
export BOOTPARAM_IFNAME
|
export BOOTPARAM_IFNAME
|
||||||
export BOOTPARAM_IP_VER
|
export BOOTPARAM_IP_VER
|
||||||
export BOOTPARAM_ROUTE_OPTIONS
|
|
||||||
export BOOTPARAM_METRIC
|
export BOOTPARAM_METRIC
|
||||||
export BOOTPARAM_DNS
|
export BOOTPARAM_DNS
|
||||||
}
|
}
|
||||||
@ -1543,8 +1536,8 @@ mgmt_dev=${BOOTPARAM_IFNAME}
|
|||||||
mgmt_vlan=${BOOTPARAM_VLAN}
|
mgmt_vlan=${BOOTPARAM_VLAN}
|
||||||
mgmt_address_family=${BOOTPARAM_MGMT_ADDRESS_FAMILY}
|
mgmt_address_family=${BOOTPARAM_MGMT_ADDRESS_FAMILY}
|
||||||
|
|
||||||
if [ $mgmt_vlan -eq 0 ] ; then
|
if [ -z "${mgmt_vlan}" ] ; then
|
||||||
|
# NO VLAN
|
||||||
if [ "$mgmt_address_family" = "inet" ]; then
|
if [ "$mgmt_address_family" = "inet" ]; then
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}"
|
ilog "ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}"
|
||||||
ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}
|
ip ${BOOTPARAM_IP_VER} address add ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN} dev ${mgmt_dev}
|
||||||
@ -1554,8 +1547,16 @@ if [ $mgmt_vlan -eq 0 ] ; then
|
|||||||
fi
|
fi
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up"
|
ilog "ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up"
|
||||||
ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up
|
ip ${BOOTPARAM_IP_VER} link set dev ${mgmt_dev} up
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} route add default ${BOOTPARAM_ROUTE_OPTIONS} dev ${mgmt_dev} ${BOOTPARAM_METRIC}"
|
|
||||||
ip ${BOOTPARAM_IP_VER} route add default ${BOOTPARAM_ROUTE_OPTIONS} dev ${mgmt_dev} ${BOOTPARAM_METRIC}
|
if [ -z "${BOOTPARAM_GW}" ]; then
|
||||||
|
# No gateway
|
||||||
|
ilog "ip ${BOOTPARAM_IP_VER} route add default dev ${mgmt_dev} ${BOOTPARAM_METRIC}"
|
||||||
|
ip ${BOOTPARAM_IP_VER} route add default dev ${mgmt_dev} ${BOOTPARAM_METRIC}
|
||||||
|
else
|
||||||
|
ilog "Setting up default route:"
|
||||||
|
ilog "ip ${BOOTPARAM_IP_VER} route add default via ${BOOTPARAM_GW} dev ${mgmt_dev} ${BOOTPARAM_METRIC}"
|
||||||
|
ip ${BOOTPARAM_IP_VER} route add default via ${BOOTPARAM_GW} dev ${mgmt_dev} ${BOOTPARAM_METRIC}
|
||||||
|
fi
|
||||||
wait_for_interface ${mgmt_dev} 60
|
wait_for_interface ${mgmt_dev} 60
|
||||||
ilog "ip addr:"
|
ilog "ip addr:"
|
||||||
ip addr show
|
ip addr show
|
||||||
@ -1563,6 +1564,7 @@ if [ $mgmt_vlan -eq 0 ] ; then
|
|||||||
ip ${BOOTPARAM_IP_VER} route show
|
ip ${BOOTPARAM_IP_VER} route show
|
||||||
|
|
||||||
else
|
else
|
||||||
|
# VLAN CONFIG
|
||||||
mgmt_iface=vlan${mgmt_vlan}
|
mgmt_iface=vlan${mgmt_vlan}
|
||||||
ilog "mgmt_dev=${mgmt_dev}"
|
ilog "mgmt_dev=${mgmt_dev}"
|
||||||
ilog "mgmt_iface=vlan${mgmt_vlan}"
|
ilog "mgmt_iface=vlan${mgmt_vlan}"
|
||||||
@ -1580,19 +1582,30 @@ else
|
|||||||
fi
|
fi
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}"
|
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}"
|
||||||
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}
|
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_dev}
|
||||||
|
# TODO(kmacleod) change to wait_for_interface 60:
|
||||||
sleep 15
|
sleep 15
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}"
|
ilog "ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}"
|
||||||
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}
|
ip ${BOOTPARAM_IP_VER} link set up dev ${mgmt_iface}
|
||||||
|
# TODO(kmacleod) change to wait_for_interface 60:
|
||||||
ilog "Wait 10s to settle interface..."
|
ilog "Wait 10s to settle interface..."
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} route add default ${BOOTPARAM_ROUTE_OPTIONS} dev ${mgmt_iface} ${BOOTPARAM_METRIC}"
|
if [ -z "${BOOTPARAM_GW}" ]; then
|
||||||
ip ${BOOTPARAM_IP_VER} route add default ${BOOTPARAM_ROUTE_OPTIONS} dev ${mgmt_iface} ${BOOTPARAM_METRIC}
|
# No gateway
|
||||||
|
ilog "ip ${BOOTPARAM_IP_VER} route add default dev ${mgmt_iface} ${BOOTPARAM_METRIC}"
|
||||||
|
ip ${BOOTPARAM_IP_VER} route add default dev ${mgmt_iface} ${BOOTPARAM_METRIC}
|
||||||
|
else
|
||||||
|
ilog "Setting up default route:"
|
||||||
|
ilog "ip ${BOOTPARAM_IP_VER} route add default via ${BOOTPARAM_GW} dev ${mgmt_iface} ${BOOTPARAM_METRIC}"
|
||||||
|
ip ${BOOTPARAM_IP_VER} route add default via ${BOOTPARAM_GW} dev ${mgmt_iface} ${BOOTPARAM_METRIC}
|
||||||
|
fi
|
||||||
|
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} addr:"
|
ilog "ip ${BOOTPARAM_IP_VER} addr:"
|
||||||
ip ${BOOTPARAM_IP_VER} addr show
|
ip ${BOOTPARAM_IP_VER} addr show
|
||||||
ilog "ip ${BOOTPARAM_IP_VER} route:"
|
ilog "ip ${BOOTPARAM_IP_VER} route:"
|
||||||
ip ${BOOTPARAM_IP_VER} route show
|
ip ${BOOTPARAM_IP_VER} route show
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# get the nameserver
|
# get the nameserver
|
||||||
local dns="none"
|
local dns="none"
|
||||||
for e in \${dns}; do
|
for e in \${dns}; do
|
||||||
@ -2646,84 +2659,82 @@ fi
|
|||||||
|
|
||||||
ilog "Setup network scripts"
|
ilog "Setup network scripts"
|
||||||
|
|
||||||
if [ $mgmt_vlan -eq 0 ] ; then
|
function create_network_interface_file()
|
||||||
|
{
|
||||||
|
local ifname=${1}
|
||||||
|
local address_family=${2}
|
||||||
|
local vlan=${3:-}
|
||||||
|
|
||||||
|
local ipversion=ipv4
|
||||||
|
local ip_cmd_flag="-4"
|
||||||
|
if [ "${address_family}" == "inet6" ]; then
|
||||||
|
local ipversion=ipv6
|
||||||
|
local ip_cmd_flag="-6"
|
||||||
|
fi
|
||||||
|
local ifname_vlan="vlan${vlan}"
|
||||||
|
|
||||||
|
local logstr="Creating ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-${ifname}, ${ipversion}"
|
||||||
|
[ -n "${vlan}" ] && logstr="${logstr}, vlan interface: ${ifname_vlan}"
|
||||||
|
[ -n "${BOOTPARAM_GW}" ] && logstr="${logstr}, gw: ${BOOTPARAM_GW}"
|
||||||
|
ilog "${logstr}"
|
||||||
|
|
||||||
|
local output
|
||||||
|
if [ -z "${vlan}" ]; then
|
||||||
|
# Persist the boot device to the platform configuration
|
||||||
|
# overwritten later if the management_interface is on a bonded interface.
|
||||||
|
update_platform_conf "management_interface=${ifname}"
|
||||||
|
|
||||||
|
# NO VLAN
|
||||||
|
output="auto ${ifname}\n"
|
||||||
|
output="${output}iface ${ifname} ${address_family} static\n"
|
||||||
|
output="${output} address ${BOOTPARAM_IP_ADDR}/$BOOTPARAM_PREFIX_LEN\n"
|
||||||
|
if [ -n "${BOOTPARAM_GW}" ]; then
|
||||||
|
output="${output} gateway $BOOTPARAM_GW\n"
|
||||||
|
fi
|
||||||
|
output="${output} mtu 1500\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/lo/autoconf\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/lo/accept_ra\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/lo/accept_redirects\n"
|
||||||
|
echo -e "${output}" > "${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-${ifname}"
|
||||||
|
else
|
||||||
|
# CONFIGURE FOR VLAN
|
||||||
# Persist the boot device to the platform configuration. This will get
|
# Persist the boot device to the platform configuration. This will get
|
||||||
# overwritten later if the management_interface is on a bonded interface.
|
# overwritten later if the management_interface is on a bonded interface.
|
||||||
update_platform_conf "management_interface=$mgmt_dev"
|
update_platform_conf "management_interface=${ifname_vlan}"
|
||||||
|
|
||||||
# Build networking scripts
|
# 1. Configure device interface:
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo
|
output="auto ${ifname}\n"
|
||||||
auto lo
|
output="${output}iface ${ifname} ${address_family} manual\n"
|
||||||
iface lo inet loopback
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname}/autoconf\n"
|
||||||
EOF
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname}/accept_ra\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname}/accept_redirects\n"
|
||||||
|
echo -e "${output}" > "${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-${ifname}"
|
||||||
|
|
||||||
if [ $mgmt_dev != "lo" ]; then
|
# 2. Configure VLAN interface:
|
||||||
ilog "Creating ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev"
|
output="auto ${ifname_vlan}\n"
|
||||||
if [ "${mgmt_address_family}" == "inet" ]; then
|
output="${output}iface ${ifname_vlan} ${address_family} static\n"
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev
|
output="${output} vlan-raw-device ${ifname}\n"
|
||||||
auto $mgmt_dev
|
output="${output} address ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN}\n"
|
||||||
iface $mgmt_dev inet static
|
if [ -n "${BOOTPARAM_GW}" ]; then
|
||||||
address $BOOTPARAM_IP_ADDR/$BOOTPARAM_PREFIX_LEN
|
output="${output} gateway ${BOOTPARAM_GW}\n"
|
||||||
gateway $BOOTPARAM_GW
|
|
||||||
mtu 1500
|
|
||||||
EOF
|
|
||||||
else # inet6
|
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev
|
|
||||||
auto $mgmt_dev
|
|
||||||
iface $mgmt_dev inet6 static
|
|
||||||
address $BOOTPARAM_IP_ADDR/$BOOTPARAM_PREFIX_LEN
|
|
||||||
mtu 1500
|
|
||||||
post-up echo 0 > /proc/sys/net/ipv6/conf/lo/autoconf; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/lo/accept_redirects
|
|
||||||
EOF
|
|
||||||
fi
|
fi
|
||||||
|
output="${output} mtu 1500\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname_vlan}/autoconf\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname_vlan}/accept_ra\n"
|
||||||
|
output="${output} post-up echo 0 > /proc/sys/net/${ipversion}/conf/${ifname_vlan}/accept_redirects\n"
|
||||||
|
echo -e "${output}" > "${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-${ifname_vlan}"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
else # vlan
|
# Build networking scripts
|
||||||
ilog "Configuring vlan: mgmt_iface=vlan${mgmt_vlan}"
|
|
||||||
|
|
||||||
# Persist the boot device to the platform configuration. This will get
|
# Loopback file
|
||||||
# overwritten later if the management_interface is on a bonded interface.
|
lo_file="${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo"
|
||||||
update_platform_conf "management_interface=vlan${mgmt_vlan}"
|
echo "auto lo" > "${lo_file}"
|
||||||
|
echo "iface lo ${mgmt_address_family} loopback" >> "${lo_file}"
|
||||||
|
|
||||||
# Build networking scripts
|
if [ "${mgmt_dev}" != "lo" ]; then
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo
|
create_network_interface_file "${mgmt_dev}" "${mgmt_address_family}" "${mgmt_vlan}"
|
||||||
auto lo
|
|
||||||
iface lo ${mgmt_address_family} loopback
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "${mgmt_address_family}" == "inet" ]; then
|
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-$mgmt_dev
|
|
||||||
auto ${mgmt_dev}
|
|
||||||
iface ${mgmt_dev} inet manual
|
|
||||||
post-up echo 0 > /proc/sys/net/ipv4/conf/${mgmt_dev}/autoconf; echo 0 > /proc/sys/net/ipv4/conf/${mgmt_dev}/accept_ra; echo 0 > /proc/sys/net/ipv4/conf/${mgmt_dev}/accept_redirects
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-vlan${mgmt_vlan}
|
|
||||||
auto vlan${mgmt_vlan}
|
|
||||||
iface vlan${mgmt_vlan} inet static
|
|
||||||
vlan-raw-device ${mgmt_dev}
|
|
||||||
address ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN}
|
|
||||||
gateway ${BOOTPARAM_GW}
|
|
||||||
mtu 1500
|
|
||||||
post-up echo 0 > /proc/sys/net/ipv4/conf/vlan${mgmt_vlan}/autoconf; echo 0 > /proc/sys/net/ipv4/conf/vlan${mgmt_vlan}/accept_ra; echo 0 > /proc/sys/net/ipv4/conf/vlan${mgmt_vlan}/accept_redirects
|
|
||||||
EOF
|
|
||||||
else # inet6
|
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-${mgmt_dev}
|
|
||||||
auto ${mgmt_dev}
|
|
||||||
iface ${mgmt_dev} inet6 manual
|
|
||||||
post-up echo 0 > /proc/sys/net/ipv6/conf/${mgmt_dev}/autoconf; echo 0 > /proc/sys/net/ipv6/conf/${mgmt_dev}/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/${mgmt_dev}/accept_redirects
|
|
||||||
EOF
|
|
||||||
|
|
||||||
cat << EOF > ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-vlan${mgmt_vlan}
|
|
||||||
auto vlan${mgmt_vlan}
|
|
||||||
iface vlan${mgmt_vlan} inet6 static
|
|
||||||
vlan-raw-device ${mgmt_dev}
|
|
||||||
address ${BOOTPARAM_IP_ADDR}/${BOOTPARAM_PREFIX_LEN}
|
|
||||||
mtu 1500
|
|
||||||
post-up echo 0 > /proc/sys/net/ipv6/conf/vlan${mgmt_vlan}/autoconf; echo 0 > /proc/sys/net/ipv6/conf/vlan${mgmt_vlan}/accept_ra; echo 0 > /proc/sys/net/ipv6/conf/vlan${mgmt_vlan}/accept_redirects
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ilog "Contents of ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo:"
|
ilog "Contents of ${IMAGE_ROOTFS}/etc/network/interfaces.d/ifcfg-lo:"
|
||||||
@ -3065,3 +3076,5 @@ fi
|
|||||||
|
|
||||||
true
|
true
|
||||||
%end
|
%end
|
||||||
|
|
||||||
|
# vim: filetype=sh
|
||||||
|
Loading…
Reference in New Issue
Block a user