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

I'm trying to add some latency to a connection to a webapp running on localhost:8080 (Tomcat). I've tried adding the following:

sudo ipfw pipe 1 config delay 500ms
sudo ipfw add 1 pipe 1 dst-port 8080

But in the browser I'm watching requests to the webapp turnaround in under 10ms according to the browser's debugger. Is it possible I'm missing something in my pipe configuration or just not understanding what the browser is saying?

I've also tried adding really long delays (up to a few seconds) but it doesn't seem to stop me from: telnet localhost 8080 and connecting immediately.

share|improve this question

2 Answers 2

I'm playing around with this myself. Try also setting your src-port to be the same.

This works fine for me:

# sudo ipfw pipe 1 config delay 500ms
# sudo ipfw add 1 pipe 1 src-port 9160
# sudo ipfw add 2 pipe 1 dst-port 9160

Viewing the ipfw settings helps debugging any problems too:

# sudo ipfw show
00001    58   69110 pipe 1 ip from any 9160 to any
00002    59    3138 pipe 1 ip from any to any dst-port 9160

# sudo ipfw pipe show
00001: unlimited  500 ms   50 sl. 1 queues (1 buckets) droptail
    mask: 0x00 0x00000000/0x0000 -> 0x00000000/0x0000
BKT Prot ___Source IP/port____ ____Dest. IP/port____ Tot_pkt/bytes Pkt/Byte Drp
  0 tcp        127.0.0.1/53547       127.0.0.1/9160   270    92414  0    0   0

In my case I'm using Cassandra, and it (painfully) obviously works.

share|improve this answer
    
Interesting. Do you need the second pipe to properly do this? Is the delay only the 1st pipe? –  Bradley Aug 6 '12 at 22:05
    
There is only one pipe--it is used by the two rules. The 1 and 2 you see are the number of the rules IIRC, the "pipe 1" text afterwards is referring to the pipe. –  Gerald Kaszuba Aug 7 '12 at 1:40
    
Do you need it on both ends src-port and dst-port to get the delay to work? –  Bradley Aug 8 '12 at 19:20

For me the solution was using the IP address:

telnet localhost <port> (connects immediately)

telnet 127.0.0.1 <port> (works as expected)

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.