Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Introducing packet-loss using iptables?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1606
Location: Fayetteville, NC, USA

PostPosted: Sat Nov 28, 2020 1:59 am    Post subject: Introducing packet-loss using iptables? Reply with quote

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
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 23071

PostPosted: Sat Nov 28, 2020 4:42 am    Post subject: Reply with quote

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
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6920

PostPosted: Sat Nov 28, 2020 9:49 am    Post subject: Reply with quote

You want tc-netem for this, not iptables.
Back to top
View user's profile Send private message
The_Great_Sephiroth
Veteran
Veteran


Joined: 03 Oct 2014
Posts: 1606
Location: Fayetteville, NC, USA

PostPosted: Sat Nov 28, 2020 5:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum