PDA

Bekijk de volledige versie : How to see total number of connections



Tellus1
30-11-2007, 17:45
Is there any way to check the total number of open connections on the router (such as netstat -s on a Windows PC shows you a line with "Current connections=...")?
(And I mean all the connections between WAN and the computers in LAN - not only between router services and WAN.)

al37919
30-11-2007, 18:03
/bin/netstat
for more advanced version:
ipkg install net-tools

Tellus1
30-11-2007, 18:22
netstat shows only the following

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost.localdoma:www localhost.localdom:3328 TIME_WAIT
tcp 0 0 localhost.localdoma:www localhost.localdom:3329 TIME_WAIT
tcp 0 0 localhost.localdoma:www localhost.localdom:3330 TIME_WAIT
tcp 0 0 localhost.localdoma:www localhost.localdom:3331 TIME_WAIT
tcp 0 0 localhost.localdoma:www localhost.localdom:3327 TIME_WAIT
tcp 0 536 ::ffff:192.168.8:telnet ::ffff:192.168.83.:2256 ESTABLISHED
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags Type State I-Node Path
unix 4 [ ] DGRAM 342 /dev/log
unix 2 [ ] DGRAM 167213
unix 2 [ ] DGRAM 347
unix 2 [ ] DGRAM 340
unix 2 [ ] DGRAM 338
unix 2 [ ] DGRAM 335
unix 2 [ ] DGRAM 333
unix 2 [ ] DGRAM 331
unix 2 [ ] DGRAM 329
unix 2 [ ] DGRAM 327
unix 2 [ ] DGRAM 324


Which is the number of connections?

al37919
30-11-2007, 18:30
это? Если да, то я же сказал net-tools


root@wl500g,~> /opt/bin/netstat -s
Ip:
3427358 total packets received
1746451 forwarded
12924 incoming packets discarded
1634576 incoming packets delivered
1613616 requests sent out
1162 outgoing packets dropped
45 dropped because of missing route
9 reassemblies required
4 packets reassembled ok
2 fragments received ok
172 fragments failed
4 fragments created
Icmp:
12924 ICMP messages received
77 input ICMP message failed.
ICMP input histogram:
destination unreachable: 10374
timeout in transit: 3
echo requests: 106
echo replies: 2441
30060 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
destination unreachable: 28792
redirect: 1162
echo replies: 106
Tcp:
20210 active connections openings
20082 passive connection openings
56 failed connection attempts
0 connection resets received
4 connections established
1512342 segments received
1479135 segments send out
24917 segments retransmited
0 bad segments received.
95 resets sent
Udp:
92293 packets received
12390 packets to unknown port received.
0 packet receive errors
92184 packets sent
TcpExt:
70 resets received for embryonic SYN_RECV sockets
217 packets pruned from receive queue because of socket buffer overrun
ArpFilter: 0
19644 TCP sockets finished time wait in fast timer
8266 delayed acks sent
813 delayed acks further delayed because of locked socket
Quick ack mode was activated 349 times
1719 times the listen queue of a socket overflowed
1719 SYNs to LISTEN sockets ignored
26814 packets directly queued to recvmsg prequeue.
300023746 packets directly received from backlog
38420916 packets directly received from prequeue
419663 packets header predicted
241112 packets header predicted and directly queued to user
TCPPureAcks: 171668
TCPHPAcks: 607724
TCPRenoRecovery: 0
TCPSackRecovery: 9857
TCPSACKReneging: 0
TCPFACKReorder: 3
TCPSACKReorder: 29
TCPRenoReorder: 0
TCPTSReorder: 0
TCPFullUndo: 1
TCPPartialUndo: 17
TCPDSACKUndo: 0
TCPLossUndo: 70
TCPLoss: 7603
TCPLostRetransmit: 5
TCPRenoFailures: 0
TCPSackFailures: 1853
TCPLossFailures: 497
TCPFastRetrans: 13305
TCPForwardRetrans: 259
TCPSlowStartRetrans: 3358
TCPTimeouts: 1262
TCPRenoRecoveryFail: 0
TCPSackRecoveryFail: 2324
TCPSchedulerFailed: 11
TCPRcvCollapsed: 3660
TCPDSACKOldSent: 415
TCPDSACKOfoSent: 0
TCPDSACKRecv: 0
TCPDSACKOfoRecv: 0
TCPAbortOnSyn: 0
TCPAbortOnData: 15
TCPAbortOnClose: 167
TCPAbortOnMemory: 0
TCPAbortOnTimeout: 55
TCPAbortOnLinger: 0
TCPAbortFailed: 0
TCPMemoryPressures: 0

Tellus1
24-01-2008, 16:19
Well, I've created an alias that contains:

sed -n '"'"'s%.* src=\(192.168.[0-9.]*\).*%\1%p'"'"' /proc/net/ip_conntrack | sort | uniq -c

It shows me the number of open connections on each host.