Update build_nat_network.sh

This commit is contained in:
spiritlhl 2023-06-03 14:29:56 +08:00 committed by GitHub
parent ff4f2f34db
commit 6a6e45e62c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,7 +31,9 @@ fi
IPV4=$(ip -4 addr show | grep global | awk '{print $2}' | cut -d '/' -f1 | head -n 1)
# 查询信息
apt-get install lshw -y
if ! command -v lshw > /dev/null 2>&1; then
apt-get install -y lshw
fi
interface=$(lshw -C network | awk '/logical name:/{print $3}' | head -1)
if [ -z "$interface" ]; then
interface="eth0"