Closed BluceHuang closed 3 years ago
cpp
Linux
gcc
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
当系统上存在如下两个网口配置时,使用linux-install.sh脚本部署会有问题,获取不到有效IP地址 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.13.145 netmask 255.255.240.0 broadcast 172.17.15.255 ether 00:16:3e:32:1c:65 txqueuelen 1000 (Ethernet) RX packets 25385738 bytes 6622473179 (6.1 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 18265294 bytes 15805736820 (14.7 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth084aa16: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether ee:c7:7a:c3:67:bc txqueuelen 0 (Ethernet) RX packets 2844063 bytes 255202967 (243.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1546386 bytes 432073030 (412.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
linux-install.sh 脚本里面 get_host_ip函数 IP=ifconfig | grep -w $1 -A 1 | tail -1 | awk '{print $2}' | cut -d ':' -f 2 有问题?
ifconfig | grep -w $1 -A 1 | tail -1 | awk '{print $2}' | cut -d ':' -f 2
原来是IP=ifconfig | grep $1 -A 1 | tail -1 | awk '{print $2}' | cut -d ':' -f 2
拿不到IP么? 我怎么试了一下貌似可以拿到?
What language are you using?
cpp
What operating system (Linux, Ubuntu, …) and version?
Linux
What runtime / compiler are you using (e.g. jdk version or version of gcc)
gcc
Make sure you include information that can help us debug (full error message, exception listing, stack trace, logs).
当系统上存在如下两个网口配置时,使用linux-install.sh脚本部署会有问题,获取不到有效IP地址 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.17.13.145 netmask 255.255.240.0 broadcast 172.17.15.255 ether 00:16:3e:32:1c:65 txqueuelen 1000 (Ethernet) RX packets 25385738 bytes 6622473179 (6.1 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 18265294 bytes 15805736820 (14.7 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth084aa16: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 ether ee:c7:7a:c3:67:bc txqueuelen 0 (Ethernet) RX packets 2844063 bytes 255202967 (243.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1546386 bytes 432073030 (412.0 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
linux-install.sh 脚本里面 get_host_ip函数 IP=
ifconfig | grep -w $1 -A 1 | tail -1 | awk '{print $2}' | cut -d ':' -f 2
有问题?