View previous topic :: View next topic |
Author |
Message |
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1606 Location: Fayetteville, NC, USA
|
Posted: Sat Nov 28, 2020 1:59 am Post subject: Introducing packet-loss using iptables? |
|
|
I am trying to simulate a bad UDP link for a project. I have a co-worker who can connect to me whenever we want to test this. For now we're using a game to attempt this, but will switch once we know we are doing it correctly. The game shows real-time packet-loss and such and is why we're testing with it before testing the commercial software over a weak link. We are not sure how to do this though. I have his static IP and can come up with part of the equation but not sure about the rest.
Code: |
iptables -I FORWARD -p udp -s 1.2.3.4/32 --dport 1024:1032 ????? -j DROP
|
I am assuming I will need to use the "recent" module, but how? _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 23071
|
Posted: Sat Nov 28, 2020 4:42 am Post subject: |
|
|
You might find it easier to use the statistic module, which allows you to define a rule to match 1 out of every N packets, or to match a packet N% of the time. See man iptables-extensions, and search for probability for how to use it. |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Nov 28, 2020 9:49 am Post subject: |
|
|
You want tc-netem for this, not iptables. |
|
Back to top |
|
|
The_Great_Sephiroth Veteran
Joined: 03 Oct 2014 Posts: 1606 Location: Fayetteville, NC, USA
|
Posted: Sat Nov 28, 2020 5:25 pm Post subject: |
|
|
Ant, I will be doing this on a Linux-based router. It probably won't have everything Gentoo has. _________________ Ever picture systemd as what runs "The Borg"? |
|
Back to top |
|
|
|