1.在ifconfig内容中查找ipLinux中查看ip的方法有很多,ifconfig就是其中之一。[root@localhost~]#ifconfigens33|grep"inet"\>|awk'{print$2}'#awk默认的分隔符是空格,ping可以理解,但是在linux下,ping命令会一直ping不通自动做什么[root@localhost~]#pingwww.baidu.com-c4#-c次[root@localhost~]#netstat-an|grep-vunix#显示网络连接信息,-aall,-nactualAddress|grep-v你懂的,就是反向显示(不是显示满足条件)2.查看网络连接状态,汇总信息[root@localhost~]#netstat-an|greptcp[root@localhost~]#netstat-an|greptcp|awk'{++S[$NF]}END{for(ainS)printa,S[a]}'[root@localhost~]#netstat-an|awk'/^tcp/{++S[$NF]}END{for(ainS)printa,S[a]}'#有很多种写法3.查看系统路由表,两种方法[root@localhost~]#netstat-rn[root@localhost~]#netstat-r4,跟踪网络数据包的路径,使用traceroute命令解释经过的路由[root@localhost~]#traceroutewww.12306。com5,根据域名查看ip[root@localhost~]#nslookupwww.baidu.com可以使用dig命令查看NS(域名服务器)记录。更详细的dig在linux上的使用方法可以参考。[root@localhost~]#digwww.taobao.com6、查看端口状态a、lsof-i:端口号用于查看某个端口的占用情况,比如查看8000端口的使用情况,lsof-i:8000b,netstat-tunlp|grep端口号,用于查看指定端口号的进程,比如查看8000端口的情况,netstat-tunlp|grep8000c。查看网口信息:ifconfigeth0,
