免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2692 | 回复: 1
打印 上一主题 下一主题

netstat命令查看的项目和chkconfig不一致 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-12-16 16:23 |显示全部楼层 |倒序浏览
今天在读鸟哥私房菜的时候,看到“觀察系統已啟動的服務方式很多,不過,我們最常使用 netstat 來觀察”这一段。于是自己实验了一下,却发现如下问题:

我用netstat命令观察系统开启哪些服务时,显示结果很少。。。和后来使用chkconfig显示的信息有很大差别。。。

# 我先使用netstat查看系统目前开启的服务

[root@llinux ~]# netstat -anlp | grep -v ^unix
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      5019/hpiod         
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      5210/mysqld         
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4741/portmap        
tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      5060/cupsd         
tcp        0      0 0.0.0.0:727                 0.0.0.0:*                   LISTEN      4785/rpc.statd      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      5248/sendmail: acce
tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      5024/python         
tcp        1      1 192.168.1.101:34641         140.116.44.180:80           LAST_ACK    -                  
udp        0      0 0.0.0.0:32768               0.0.0.0:*                               5356/avahi-daemon:  
udp        0      0 0.0.0.0:68                  0.0.0.0:*                               4573/dhclient      
udp        0      0 0.0.0.0:721                 0.0.0.0:*                               4785/rpc.statd      
udp        0      0 0.0.0.0:724                 0.0.0.0:*                               4785/rpc.statd      
udp        0      0 0.0.0.0:5353                0.0.0.0:*                               5356/avahi-daemon:  
udp        0      0 0.0.0.0:111                 0.0.0.0:*                               4741/portmap        
udp        0      0 0.0.0.0:631                 0.0.0.0:*                               5060/cupsd         
udp        0      0 :::32769                    :::*                                    5356/avahi-daemon:  
udp        0      0 :::5353                     :::*                                    5356/avahi-daemon:


# 然后我尝试用另外一种方法查看系统开启的服务

[root@llinux ~]# cat /etc/inittab | grep initdefault
id:3:initdefault:

[root@llinux ~]# chkconfig --list | grep 3n | cut -d ' ' -f 1
acpid
anacron
apmd
atd
auditd
autofs
avahi-daemon
bluetooth
cpuspeed
crond
cups
firstboot
gpm
haldaemon
hidd
hplip
ip6tables
iptables
irqbalance
isdn
lm_sensors
lvm2-monitor
mcstrans
mdmonitor
messagebus
microcode_ctl
mysqld
network
nfslock
pcscd
portmap
readahead_early
restorecond
rpcgssd
rpcidmapd
sendmail
setroubleshoot
smartd
sshd
syslog
tim1
xinetd
yum-updatesd


---------------------------------------------
为什么两者差了这么多呢? netstat显示的项目好少,而chkconfig列出了那么多。请问各位弟兄,这是什么原因?在此谢过了!

[ 本帖最后由 aijoex 于 2008-12-16 16:26 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-04-01 21:00 |显示全部楼层
很抱歉,没有及时回复各位。我还是有点混乱,是不是应该这样理解

chkconfig 查看的是系统所有服务
netstat查看的是网络服务,其中包括了监听服务。

感谢楼上几位前辈,兄长的回复。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP