Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

First, just a bit of background:

My ISP has decided to block all inbound connections (from their customers' perspective) which effectively means that I can no longer host anything on my connection (FTP, HTTP etc.) or use any of a number of programs that require one or more listening ports to be specified for use by inbound connections (SSH, RDP, uTorrent, etc. etc.)

Apparently they recently "suffered" a port scan attack on an entire IP range that has been allocated for use by their subscribers and their reasoning now (as a metered-bandwidth ISP) is that allowing inbound connections again will generate too much additional, unsolicited traffic which the majority of their subscribers will not be willing to pay for (or even understand where it's coming from).

I disagree in that, in the grand scheme of things, I don't think a bunch of SYN packets and the resulting NACK (?) packets as sent back from a host-based firewall (for example) will end up causing THAT much additional traffic.

My question is whether there is any way in which I can measure the amount of bandwidth that such a port scan will typically generate if I were to scan all the ports on my own machine? nmap is ideal for this, but I'm not sure how one would measure the total bandwidth (including the 'reject' packets sent back from the target machine, if any).

I am fairly proficient with the bash shell and know my way around Linux. Any help would be greatly appreciated!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

You can use iptables(add allow rules)

Scanning host 8.8.8.8:

# iptables -I INPUT 1 -s 8.8.8.8 -j ACCEPT
# iptables -I OUTPUT 1 -d 8.8.8.8 -j ACCEPT
# iptables -Z && nmap -O 8.8.8.8
# iptables -vn -L
Chain INPUT (policy ACCEPT 273 packets, 17374 bytes)
 pkts bytes target     prot opt in     out     source               destination         
    8   320 ACCEPT     all  --  *      *       8.8.8.8              0.0.0.0/0           

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination         

Chain OUTPUT (policy ACCEPT 140 packets, 13386 bytes)
 pkts bytes target     prot opt in     out     source               destination         
 2043 94224 ACCEPT     all  --  *      *       0.0.0.0/0            8.8.8.8 
share|improve this answer
1  
Thanks, that was pretty straightforward. If anyone is interested, the scan I ran completed in 115s and it took a total of 2,062 bytes. If my math is correct and assuming a lot of things that shouldn't be assumed, that would work out to around 45.8 MB if I were to scan the target IP continuously for a whole month. –  Xhantar Feb 22 '11 at 14:26
    
Sorry to be so late, and to be the bearer of bad news... but the scan you ran is the default scan. It only checks 1000 ports. You'll find that a full scan (65535 ports, which you can call using -p 1-65535) actually generates about 4.5MB of traffic for each host. –  Très May 27 at 3:04

You could probably use tcpdump or wireshark to measure the traffic. But be sure to disable all other traffic, web-browsers, mail clients, ntp updates, skype or any pther chat software, etc. Or just disconnect all clients.

Or just filter the right traffic with tcpdump or wireshark.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.