Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to make a kind of WiFi proxy. And therefore I want to know how can I reroute packets that are going through specific adapter to destination IP:port.

share|improve this question

closed as not a real question by mgorven, MadHatter, David Schwartz, HopelessN00b, Michael Hampton Nov 20 '12 at 23:23

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

It would help to have some information about the devices you are going to be using, this would help determine what approach can be taken to accomplish what you want. – Sane Nov 20 '12 at 19:46
What do you mean by "going through specific adapter"?! Do you mean packets received on a particular adapter? What were these packets originally sent to? Are you talking about bridging or routing? What do your IP addresses look like? Are you connecting devices on the same subnet or are you connecting distinct subnets? What you seem to be suggesting (to the extent I understand it) would be pointless since you'd never get any replies back. – David Schwartz Nov 20 '12 at 21:18

I assume you want to do that on a GNU/Linux system.

In order to re-route all the TCP traffic (since you're talking about packets) from a specific adapter to a specific IP address and port, you should:

  1. Enable the IP forwarding capability of the Linux kernel. To do that, you must add the following configuration to /etc/sysctl.conf and reboot your system:

    net.ipv4.ip_forward = 1

  2. Next, create the iptables rule for the forwarding:

    iptables -t nat -A PREROUTING -i $DEVICE -p TCP -d $IP --dport $PORT -j REDIRECT

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.