# netstat -nltp
p 查看端口挂的程序
[root@iz2ze5is23zeo1ipvn65aiz ~]# netstat -nltpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address ??????????Foreign Address ????????State ??????PID/Program name ???tcp ???????0 ?????0 0.0.0.0:80 ?????????????0.0.0.0:* ??????????????LISTEN ?????3346/nginx: master ?tcp ???????0 ?????0 127.0.0.1:8081 ?????????0.0.0.0:* ??????????????LISTEN ?????2493/docker-proxy-c tcp ???????0 ?????0 127.0.0.1:8082 ?????????0.0.0.0:* ??????????????LISTEN ?????5529/docker-proxy-c tcp ???????0 ?????0 127.0.0.1:8083 ?????????0.0.0.0:* ??????????????LISTEN ?????17762/docker-proxy- tcp ???????0 ?????0 127.0.0.1:8084 ?????????0.0.0.0:* ??????????????LISTEN ?????2743/docker-proxy-c tcp ???????0 ?????0 0.0.0.0:22 ?????????????0.0.0.0:* ??????????????LISTEN ?????2155/sshd ???
看到 查询的有Local、Address、Foregin、Program name
Local :访问端口的方式,0.0.0.0 是对外开放端口,说明80端口外面可以访问;127.0.0.1 说明只能对本机访问,外面访问不了此端口;
Address:端口
Foregin Address:对外开放,一般都为0.0.0.0:*
Program name:此端口是那个程序在用,程序挂载此端口
重点说明 0.0.0.0 是对外开放,通过服务域名、ip可以访问的端口
127.0.0.1 只能对本机 localhost访问,也是保护此端口安全性
::: 这三个: 的前两个”::“,是“0:0:0:0:0:0:0:0”的缩写,相当于IPv6的“0.0.0.0”,就是本机的所有IPv6地址,第三个:是IP和端口的分隔符
转载自: http://www.cnblogs.com/lemon-flm/p/7396536.html