You are not logged in.
Pages: 1
I want to simulate packet loss (in both directions).
I use iptables as follows:
iptables -A INPUT -m statistic -p udp --mode random --probability 0.5 -j DROP
all OK. But when i try:
iptables -A OUTPUT -m statistic -p udp --mode random --probability 0.5 -j DROP
my code on Python2.7 return to me:
socket.error: [Errno 1] Operation not permitted
Last edited by XaverOz (2012-04-27 02:12:31)
Offline
You say UDP in the title but the iptables commands refer to TCP. We need to know what is the exact Python code (just the socket/connection part) you are using.
Entia non sunt multiplicanda praeter necessitatem
Offline
sorry form my error . i mean udp flag.
my code for output:
import socket, time
def main():
sckm = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
while True:
sckm.sendto( 'package', ("192.168.0.102", 10025) )
time.sleep(3)
if __name__ == "__main__":
main()
Last edited by XaverOz (2012-04-27 02:38:27)
Offline
Kernel appears to be telling the python process that it's not allowed to send that packet...
Perhaps redirect it to somewhere else instead:
iptables -t nat -I PREROUTING -m statistic -p udp --mode random --probability 0.5 -j DNAT --to 1.2.3.4
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
Pages: 1