获取内部和外部IP地址

获取所有接口的内部和外部IP地址,或者以参数形式给出的IP地址
.

0

linux命令:ips(){ for if in ${1:-$(ip link list|grep '^.: '|cut -d\ -f2|cut -d: -f1)};do cur=$(ifconfig $if|grep "inet addr"|sed 's/.*inet addr:\([0-9\.]*\).*/\1/g');printf '%-5s%-15s%-15s\n' $if $cur $(nc -s $cur sine.cluenet.org 128 2>/dev/null||echo $cur);done;} $cur);done;} 2>/dev/null||echo 128 sine.cluenet.org $cur -s $(nc $cur $if '%-5s%-15s%-15s\n' addr:\([0-9\.]*\).*/\1/g');printf 's/.*inet addr"|sed "inet $if|grep cur=$(ifconfig -f1)};do -d: -f2|cut -d\ '|cut '^.: list|grep link ${1:-$(ip in if for ips(){ ips(){ for if in ${1:-$(ip link list|grep '^.: '|cut -d\ -f2|cut -d: -f1)};do cur=$(ifconfig $if|grep "inet addr"|sed 's/.*inet addr:\([0-9\.]*\).*/\1/g');printf '%-5s%-15s%-15s\n' $if $cur $(nc -s $cur sine.cluenet.org 128 2>/dev/null||echo $cur);done;}rootopen.com
linux命令:ips(){ for if in ${1:-$(ip link list|grep '^.: '|cut -d\ -f2|cut -d: -f1)};do cur=$(ifconfig $if|grep "inet addr"|sed 's/.*inet addr:\([0-9\.]*\).*/\1/g');printf '%-5s%-15s%-15s\n' $if $cur $(nc -s $cur sine.cluenet.org 128 2>/dev/null||echo $cur);done;} $cur);done;} 2>/dev/null||echo 128 sine.cluenet.org $cur -s $(nc $cur $if '%-5s%-15s%-15s\n' addr:\([0-9\.]*\).*/\1/g');printf 's/.*inet addr"|sed "inet $if|grep cur=$(ifconfig -f1)};do -d: -f2|cut -d\ '|cut '^.: list|grep link ${1:-$(ip in if for ips(){ ips(){ for if in ${1:-$(ip link list|grep '^.: '|cut -d\ -f2|cut -d: -f1)};do cur=$(ifconfig $if|grep "inet addr"|sed 's/.*inet addr:\([0-9\.]*\).*/\1/g');printf '%-5s%-15s%-15s\n' $if $cur $(nc -s $cur sine.cluenet.org 128 2>/dev/null||echo $cur);done;}rootopen.com
sxoz 2018-05-23 18:13:48
输出

评论

相关推荐
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

热门文章