On Linux, it simulates slow traffic of incoming traffic per port, for example. 54,000

Is there a way in Linux to simulate slow traffic coming to my server on a specific port? I looked at NETEM, but this only seems to be widespread.

+7
source share
2 answers

An example of restricting all traffic corresponding to tcp (protocol 6) of destination port 54000 with incoming 256 Kbps on eth0 using tc ...

As root ...

 tc qdisc add dev eth0 handle ffff: ingress tc filter add dev eth0 parent ffff: protocol ip prio 50 u32 \ match ip protocol 6 0xff \ match ip dport 54000 0xffff police rate 256kbit burst 10k drop \ flowid :1 

You can track it like this: pay attention to the dropped number for ffff below

 [ mpenning@Bucksnort ~]$ sudo tc -s qdisc show qdisc pfifo_fast 0: dev eth0 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 Sent 17796311917 bytes 5850423 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 qdisc ingress ffff: dev eth0 parent ffff:fff1 ---------------- Sent 140590 bytes 1613 pkt (dropped 214, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 qdisc pfifo_fast 0: dev eth1 root refcnt 2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1 Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0) rate 0bit 0pps backlog 0b 0p requeues 0 [ mpenning@Bucksnort ~]$ 

To remove all input traffic filters:

 tc qdisc del dev eth0 ingress 
+4
source

Take a look at JMeter . Depending on what type of traffic you need, it may already provide functionality.

0
source

All Articles