1
0
mirror of https://github.com/moshix/mvs.git synced 2026-01-11 23:43:00 +00:00

v1.3 handle virtual NICs like ens160:1

This commit is contained in:
moshix 2023-04-17 05:08:39 -05:00 committed by GitHub
parent 771d77963e
commit c8e3029f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,8 +17,9 @@
# v 1.0 DNS check and user speed perception improvements
# v 1.1 Which NIC to internet
# v 1.2 Add more NIC types and handle loopback better
# v 1.3 Hanlde virtual NICS like ens160:1
version="1.2"
version="1.3"
set_color() {
# terminal handling globals
@ -100,6 +101,15 @@ do
echo -n -e "${blue}$nictype$counter: \t\t${reset}"
ifconfig "$nictype$counter" | grep "inet " | awk 'BEGIN{ORS=""}{print $2}' # ORS controls new line
echo -e "${reset}"
for virtual in :0 :1 :2 :3 :4 :5 :6 :6
do
resultvirt=`ifconfig $nictype$counter$virtual 2>/dev/null`
if grep -q "inet " <<< "$resultvirt"; then #virtual NIC exists...
echo -n -e "${blue}$nictype$counter$virtual: \t\t${reset}"
ifconfig "$nictype$counter$virtual" | grep "inet " | awk 'BEGIN{ORS=""}{print $2}' # ORS controls new line
echo -e "${reset}"
fi
done
fi
done
done