TarsCloud / Tars

Tars is a high-performance RPC framework based on name service and Tars protocol, also integrated administration platform, and implemented hosting-service via flexible schedule.
BSD 3-Clause "New" or "Revised" License
9.79k stars 2.08k forks source link

hostip get error #821

Closed BluceHuang closed 3 years ago

BluceHuang commented 3 years ago

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 有问题?

BluceHuang commented 3 years ago

原来是IP=ifconfig | grep $1 -A 1 | tail -1 | awk '{print $2}' | cut -d ':' -f 2

ruanshudong commented 3 years ago

拿不到IP么? 我怎么试了一下貌似可以拿到?