Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhanced ability to deploy ubuntu network configuration on edge server #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
cd /sys/class/net
for nic in *; do
ip link set $nic up
done
mkdir -p /custom-installation
cp -a /opt/confluent /custom-installation
touch /custom-installation/confluent/confluent.info
Expand Down Expand Up @@ -31,11 +27,37 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
MYGW=""
fi
MYNM=$(grep ^ipv4_netmask: $tcfg | awk '{print $2}')
for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK|cut -d ' ' -f 2 | sed -e 's/:$//'); do
for NICGUESS in `ls /sys/class/net/`; do
if [ -n "$(ip link show "$NICGUESS" | grep "LOOPBACK")" ]; then
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this line to avoid check lo nic

echo "$NICGUESS is loopback"
continue
fi
ip link set $NICGUESS up
counter=0
while true; do
status=$(ip link show "$NICGUESS" | grep "LOWER_UP")
if [ -n "$status" ]; then
echo "Network interface $NICGUESS is LOWER_UP."
break
else
counter=$((counter + 1))
echo "Network interface $NICGUESS is not LOWER_UP. Checking again...retries $counter"
fi
if [ "$counter" -gt 20 ]; then
echo "Exceeded maximum number of checks. Exiting..."
break
fi
sleep 1
done
NICLOWERUP=`ip link |grep $NICGUESS |grep -iv LOWER_UP`
if [[ ! -z "$NICLOWERUP" ]]; then
continue
fi
ip addr add dev $NICGUESS $v4addr
if [ ! -z "$MYGW" ]; then
ip route add default via $MYGW
fi
echo "Configure ${NICGUESS} network"
for dsrv in $deploysrvs; do
if openssl s_client -connect $dsrv:443 > /dev/null 2>&1; then
deploysrvs=$dsrv
Expand All @@ -49,6 +71,11 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
break
fi
done
if [ -z "$NIC"]; then
echo "Could not configure any network interface with ${v4addr}, please check your network configuration"
sleep 20
exit 1
fi
ipconfig -d $MYIP::$MYGW:$MYNM::$NIC
echo $NIC > /tmp/autodetectnic
else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
cd /sys/class/net
for nic in *; do
ip link set $nic up
done
mkdir -p /custom-installation
cp -a /opt/confluent /custom-installation
touch /custom-installation/confluent/confluent.info
Expand Down Expand Up @@ -31,11 +27,37 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
MYGW=""
fi
MYNM=$(grep ^ipv4_netmask: $tcfg | awk '{print $2}')
for NICGUESS in $(ip link|grep LOWER_UP|grep -v LOOPBACK|cut -d ' ' -f 2 | sed -e 's/:$//'); do
for NICGUESS in `ls /sys/class/net/`; do
if [ -n "$(ip link show "$NICGUESS" | grep "LOOPBACK")" ]; then
echo "$NICGUESS is loopback"
continue
fi
ip link set $NICGUESS up
counter=0
while true; do
status=$(ip link show "$NICGUESS" | grep "LOWER_UP")
if [ -n "$status" ]; then
echo "Network interface $NICGUESS is LOWER_UP."
break
else
counter=$((counter + 1))
echo "Network interface $NICGUESS is not LOWER_UP. Checking again...retries $counter"
fi
if [ "$counter" -gt 20 ]; then
echo "Exceeded maximum number of checks. Exiting..."
break
fi
sleep 1
done
NICLOWERUP=`ip link |grep $NICGUESS |grep -iv LOWER_UP`
if [[ ! -z "$NICLOWERUP" ]]; then
continue
fi
ip addr add dev $NICGUESS $v4addr
if [ ! -z "$MYGW" ]; then
ip route add default via $MYGW
fi
echo "Configure ${NICGUESS} network"
for dsrv in $deploysrvs; do
if openssl s_client -connect $dsrv:443 > /dev/null 2>&1; then
deploysrvs=$dsrv
Expand All @@ -49,6 +71,11 @@ if [ -e /dev/disk/by-label/CNFLNT_IDNT ]; then
break
fi
done
if [ -z "$NIC"]; then
echo "Could not configure any network interface with ${v4addr}, please check your network configuration"
sleep 20
exit 1
fi
ipconfig -d $MYIP::$MYGW:$MYNM::$NIC
echo $NIC > /tmp/autodetectnic
else
Expand Down