1. 程式人生 > >Linux /proc/net/ 下檔案用途

Linux /proc/net/ 下檔案用途

系統版本

cat /proc/version 
Linux version 2.6.27.19-5-pae ([email protected]) (gcc version 4.3.2 [gcc-4_3-branch revision 141291] (SUSE Linux) ) #1 SMP 2009-02-28 04:40:21 +0100

 ls /proc/net/
arp        dev_mcast    ip_mr_vif  netlink    psched  route     snmp          stat    udp      wireless
connector  igmp         mcfilter   netstat    ptype   rt_acct   sockstat      tcp     udplite
dev        ip_mr_cache  netfilter  protocols  raw     rt_cache  softnet_stat  tr_rif  unix

詳細介紹:

/proc/net/arp

IP address       HW type     Flags       HW address            Mask     Device
192.168.1.151    0x1         0x2         00:e0:4c:19:1a:98     *        eth0
192.168.1.1      0x1         0x2         00:14:78:e7:c4:e8     *        eth0

每個網路介面的arp表中dev包的統計
IP address:IP地址(直連)
HW type:硬體型別 
23=0x17   strip (Metricom Starmode IP) 
01=0x01   ether (Ethernet) 
15=0xf      dlci (Frame Relay DLCI) 
Flags:
HW address:MAC 地址
Mask:
Device:所在網路介面

/proc/net/dev

Inter-|   Receive bytes      packets errs drop fifo frame                                              
 face |  compressed multicast
 lo:       238306  4170      0        0    0     0                 0         0
 eth0:   885217  2782      0        0    0     0                 0         0
 pan0:  0            0            0        0    0     0                 0         0
 tap0:   4092      46          0        0    0     0                 0         0

|  Transmit                                              
|bytes        packets errs drop fifo colls carrier compressed
238306     4170      0       0    0     0       0          0
3581505   19730    0       0    0     0       0          0
0                0           0       0    0     0       0          0
5644          38         0       0    0     0       0          0

網路裝置的統計

/proc/net/dev_mcast

2    eth0            1     0     01005e0000fb
2    eth0            1     0     01005e000001
5    tap0            1     0     01005e0000fb
5    tap0            1     0     01005e000001

組播包統計

/proc/net/igmp

Idx     Device    : Count Querier       Group    Users Timer    Reporter
1       lo        :     0      V3
                                010000E0     1 0:00000000               0
2       eth0      :     2      V3
                                FB0000E0     1 0:00000000               0
                                010000E0     1 0:00000000               0
5       tap0      :     2      V3
                                FB0000E0     1 0:00000000               0
                                010000E0     1 0:00000000               0

IGMP 分組情況

/proc/net/netlink

sk       Eth Pid    Groups   Rmem     Wmem     Dump     Locks
cedaae00 0   2527   00000111 0        0        00000000 2
cec2a400 0   0      00000000 0        0        00000000 2
cdc8da00 7   0      00000000 0        0        00000000 2
cef32400 9   0      00000000 0        0        00000000 2
ce000c00 9   2482   00000000 0        0        00000000 2
cecb8400 10  0      00000000 0        0        00000000 2
cecaaa00 11  0      00000000 0        0        00000000 2
cf832600 15  542    00000001 0        0        00000000 2
cec5fe00 15  0      00000000 0        0        00000000 2
cecaa800 16  0      00000000 0        0        00000000 2
cddd8a00 18  0      00000000 0        0        00000000 2

netlink套介面的資訊

/proc/net/netstat

TcpExt: SyncookiesSent SyncookiesRecv SyncookiesFailed EmbryonicRsts PruneCalled RcvPruned OfoPruned OutOfWindowIcmps LockDroppedIcmps ArpFilter TW TWRecycled TWKilled PAWSPassive PAWSActive PAWSEstab DelayedACKs DelayedACKLocked DelayedACKLost ListenOverflows ListenDrops TCPPrequeued TCPDirectCopyFromBacklog TCPDirectCopyFromPrequeue TCPPrequeueDropped TCPHPHits TCPHPHitsToUser TCPPureAcks TCPHPAcks TCPRenoRecovery TCPSackRecovery TCPSACKReneging TCPFACKReorder TCPSACKReorder TCPRenoReorder TCPTSReorder TCPFullUndo TCPPartialUndo TCPDSACKUndo TCPLossUndo TCPLoss TCPLostRetransmit TCPRenoFailures TCPSackFailures TCPLossFailures TCPFastRetrans TCPForwardRetrans TCPSlowStartRetrans TCPTimeouts TCPRenoRecoveryFail TCPSackRecoveryFail TCPSchedulerFailed TCPRcvCollapsed TCPDSACKOldSent TCPDSACKOfoSent TCPDSACKRecv TCPDSACKOfoRecv TCPAbortOnSyn TCPAbortOnData TCPAbortOnClose TCPAbortOnMemory TCPAbortOnTimeout TCPAbortOnLinger TCPAbortFailed TCPMemoryPressures TCPSACKDiscard TCPDSACKIgnoredOld TCPDSACKIgnoredNoUndo TCPSpuriousRTOs TCPMD5NotFound TCPMD5Unexpected

TcpExt: 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 555 145 2 0 0 0 0 0 0 3029 0 10463 1848 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 2 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0

IpExt: InNoRoutes InTruncatedPkts InMcastPkts OutMcastPkts InBcastPkts OutBcastPkts
IpExt:   0                    0                        30                36                    79                  0

網路流量的多種統計

/proc/net/raw

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode ref pointer drops

原始套介面的套介面表

/proc/net/route

Iface  Destination   Gateway     Flags  RefCnt Use   Metric Mask      MTU   Window IRTT                            
tap0  000010AC    00000000    0001  0    0    0    00FFFFFF    0    0    0                                        
eth0  0001A8C0    00000000    0001  0    0    0    00FFFFFF    0    0    0                                        
eth0  0000FEA9    00000000    0001  0    0    0    0000FFFF    0    0    0                                        
lo   0000007F    00000000    0001  0    0    0    000000FF    0    0    0                                         
eth0  00000000    0101A8C0    0003  0    0    0    00000000    0    0    0            

靜態路由表

/proc/net/rt_cache

Iface  Destination   Gateway     Flags      RefCnt Use   Metric Source     MTU   Window IRTT  TOS   HHRef    HHUptod SpecDst             
lo   FF01A8C0    FF01A8C0    94000000    0    0    0    9701A8C0    0    0    0    00   -10    C901A8C0                              
eth0  9701A8C0    9701A8C0        0    2    1    0    C901A8C0    1500  0    0    10   20    C901A8C0                            
lo   C901A8C0    C901A8C0    84000000    0    185   0    9701A8C0    0    0    0    00   -10    C901A8C0  

路由快取表

/proc/net/snmp

Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
Ip: 2 64 17123 0 13 0 0 0 17110 24061 0 0 0 0 0 0 0 0 0
Icmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
Icmp: 34 0 10 0 0 0 0 0 24 0 0 0 0 34 0 10 0 0 0 0 24 0 0 0 0 0
IcmpMsg: InType0 InType3 OutType3 OutType8
IcmpMsg: 24 10 10 24
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts
Tcp: 1 200 120000 -1 6 6 2 2 4 16956 23979 2 0 3
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors
Udp: 30 10 0 40 0 0
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors
UdpLite: 0 0 0 0 0 0

snmp agent的ip/icmp/tcp/udp協議統計

/proc/net/sockstat

sockets: used 556
TCP: inuse 9 orphan 0 tw 0 alloc 10 mem 2
UDP: inuse 5 mem 0
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0

使用的tcp/udp/raw/pac/syc_cookies的數量

/proc/net/tcp

 sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode                                                     
   0: 00000000:10E1 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 63205 1 c91b0500 300 0 0 2 -1                             
   1: 00000000:006F 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 5253 1 ce47aa40 300 0 0 2 -1                              
   2: 00000000:0016 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 7799 1 ce4a3a80 300 0 0 2 -1                              
   3: 0100007F:0277 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 6509 1 ce47a0c0 300 0 0 2 -1                              
   4: 0100007F:0019 00000000:0000 0A 00000000:00000000 00:00000000 00000000     0        0 7392 1 ce47a580 300 0 0 2 -1                              
   5: C901A8C0:0016 9701A8C0:0B64 01 00000034:00000000 01:00000022 00000000     0        0 16290 4 c91b09c0 35 4 3 5 4                               
   6: 0100007F:10E1 0100007F:91DE 01 00000000:00000000 00:00000000 00000000     0        0 63427 1 c91b0040 21 4 29 3 -1                             
   7: C901A8C0:0016 9701A8C0:066B 01 00000000:00000000 02:000497D5 00000000     0        0 12401 2 ce4a35c0 31 4 16 5 4                              
   8: 0100007F:91DE 0100007F:10E1 01 00000000:00000000 00:00000000 00000000     0        0 63426 1 c90a1a00 22 4 30 3 -1               

TCP連線的套介面

/proc/net/udp

  sl  local_address rem_address   st tx_queue rx_queue tr tm->when retrnsmt   uid  timeout inode ref pointer drops             
   3: 00000000:9883 00000000:0000 07 00000000:00000000 00:00000000 00000000   104        0 6195 2 ce437700 0                   
  24: 00000000:0298 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 5252 2 ce437b80 0                   
 105: 00000000:14E9 00000000:0000 07 00000000:00000000 00:00000000 00000000   104        0 6194 2 ce437940 0                   
 111: 00000000:006F 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 5220 2 ce437dc0 0                   
 119: 00000000:0277 00000000:0000 07 00000000:00000000 00:00000000 00000000     0        0 6526 2 ce437040 0                   

UDP連線的套介面表

/proc/net/unix

c9113580: 00000003 00000000 00000000 0001 03 11719
c9113740: 00000003 00000000 00000000 0001 03 11717 /var/run/dbus/system_bus_socket
c9113900: 00000003 00000000 00000000 0001 03 11716
c9113c80: 00000003 00000000 00000000 0001 03 11711 /tmp/orbit-yaozhongkai/linc-c9d-0-6437df843b36c
c9113e40: 00000003 00000000 00000000 0001 03 11710
c9078040: 00000003 00000000 00000000 0001 03 11708 @/tmp/dbus-TT8HxW0iEY

UNIX域套介面的套介面表