[why] rewrite the configure_networking function to support the configuration of multiple network cards.
Signed-off-by: Cui Yili 2268260388@qq.com --- bin/run-ipconfig | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/bin/run-ipconfig b/bin/run-ipconfig index 0f80feafe..ceff60f6f 100755 --- a/bin/run-ipconfig +++ b/bin/run-ipconfig @@ -6,6 +6,43 @@ export PATH="$PATH:/usr/lib/klibc/bin"
IP=$DIRECT_IP
+# rewrite the configure_networking function +# to support the configuration of multiple network cards +configure_networking() +{ + for device in /sys/class/net/* ; do + if [ -f "$device/address" ]; then + DEVICE=${device##*/} + + [ "${DEVICE}" = "lo" ] && continue + [ "${DEVICE}" = "docker0" ] && continue + + for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do + + [ -e /run/net-"${DEVICE}".conf ] && break + case ${IP} in + none|off) + # Do nothing + ;; + ""|on|any) + # Bring up device + ipconfig -t ${ROUNDTTT} "${DEVICE}" + ;; + dhcp|bootp|rarp|both) + ipconfig -t ${ROUNDTTT} -c "${IP}" -d "${DEVICE}" + ;; + *) + ipconfig -t ${ROUNDTTT} -d "$IP" + ;; + esac + done + + . "/run/net-${DEVICE}.conf" + fi + done + +} + read_ip() { for x in $(cat /proc/cmdline)