Tag: Linux获取ip

  • Linux获取公网出口IP或者私网IP地址

    Linux获取公网出口IP或者私网IP地址

    得到本机的公网IP(出口IP)的方法: 国内首选curl cip.cccurl myip.ipip.net 获取ipv6地址:curl http://6.moneyslow.com 国外curl http://members.3322.org/dyndns/getipcurl ifconfig.mecurl ipinfo.iocurl -4/-6 icanhazip.comcurl ipinfo.io/ipcurl api.ipify.orgcurl checkip.dyndns.orgdig +short myip.opendns.com @resolver1.opendns.comhost myip.opendns.com resolver1.opendns.comcurl ident.mecurl bot.whatismyipaddress.comcurl ipecho.net/plainThe following commands will get you the private IP address of your interfaces: 获取本地私网ip地址的方法: ifconfig -aip addr (或者 ip a)hostname -I | awk ‘{print $1}’ip route get 1.2.3.4 | awk ‘{print $7}’nmcli -p…