iptables question


 
Thread Tools Search this Thread
Special Forums IP Networking iptables question
# 1  
Old 08-05-2013
iptables question

I have two programs, a datagram socket based sender and a datagram socket based receiver. The sender emits a short UDP message to 192.168.0.100:33333 every second. The receiver creates a datagram socket with a default port number (let's say it is 44444), clears the iptables adds the following rule:
iptables -t nat -A OUTPUT -p udp --dport 14450 -j REDIRECT --to-ports 44444.
This works great when the receiver is started before the sender, but NOT if the sender is started before the receiver. It looks to me like the iptables are only consulted once on the initial message from the sender but not for any subsequent messages. Is that correct behaviour or did I miss something?
# 2  
Old 08-05-2013
Does the sender keep sending, not error out ?
# 3  
Old 08-05-2013
Yes, it ignores any error, sleeps for 1 second and sends again.
# 4  
Old 08-06-2013
How did port 14450 get involved? Does the sender have a specific from port? How does port 33333 relate to the iptables?
# 5  
Old 08-06-2013
Sorry about that, the port used by the sender should be the port referenced in the iptables command issued by the receiver (--dport 33333). The problem is not tied to a specific port number. I have not tried any of the priviledged ports (<1024).

I did another experiment with starting the sender first. The receiver now sets up iptables to redirect 33333 and 33334 to it's socket with port 44444. The sender is modified to send 20 messages to 33333 and then every other message to 33334. And guess what, the message sent to 33334 is redirected properly.

Last edited by michaelrusse; 08-06-2013 at 08:07 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Multi-table iptables Question

I have a question regarding IPTables packet flow, that I am hoping I can get an answer to. We have a fairly advanced implementation of IPTables that I am trying to convert into a third party product and I am not quite certain on the packet flow in the current IPTables implementation. We are... (2 Replies)
Discussion started by: knightfirefx
2 Replies

2. Cybersecurity

iptables question.

I am setting up a new squid daemon to run on my server. I want to make sure that everyone inside my network can access squid but I want to make sure everyone on the internet is blocked. eth0 is connected to my internal LAN via: 192.168.0.5/255.255.255.0 eth1 is connected to the internet via:... (1 Reply)
Discussion started by: nondescriptciti
1 Replies

3. UNIX for Dummies Questions & Answers

help with iptables

Hi, On the IPTABLES, I did iptables --flush. I want to start fresh. Now I only want two things. Allow one ip address to this server. Allow port 443 as incoming from every where. Please advice how to do this. This is what I did so for. iptables -I INPUT -i eth0 -s 1.2.3.4 -j ACCEPT... (5 Replies)
Discussion started by: samnyc
5 Replies

4. IP Networking

IPTables question

Hope someone can help cus m really stuck. Im pretty good at making basic IPTables rules to get what i need done, but this one has me beat. I have only 1 Nic in my linux box , and its setup as a trunk to my switch. I have 5 vlans setup on it: eth0.1000 eth0.1001 eth0.1002 eth0.1003... (0 Replies)
Discussion started by: UKShark
0 Replies

5. IP Networking

Iptables

What should be the iptables rule so that only the subnet 64.61.11.224/255.255.255.248 may access the mysql port 3306 (1 Reply)
Discussion started by: proactiveaditya
1 Replies

6. IP Networking

Need help with iptables

Trying to create a whitelist to limit bandwidth. My sync speed is 1536/256 kbps. Simple rules in order: 1. Do not limit (or set to 1536/256) MAC 00:00:00:00:00 (computer is in 192.168.1.0/24). 2. Do not limit (or set to 1536/256) MAC 00:00:00:00:01 (computer is in 192.168.1.0/24). 3. Do not... (1 Reply)
Discussion started by: kripz
1 Replies

7. Linux

iptables question need help

Description i used iptables firewall is a month,running is favorable.it is failed when i connecting to my server on time.the servers' web service and all ports did not connect.i remote login the other server and through intranet address login this server then i restart iptables .but through... (0 Replies)
Discussion started by: proceed
0 Replies

8. IP Networking

IPtables

Hey guys, I have just started using IP tables and was wondering if anyone could direct me to any good online resources as I am totally new to this. Thanks. (1 Reply)
Discussion started by: 182x
1 Replies
Login or Register to Ask a Question