Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I am running my application that include many servers. I want to modify the destination port of receiving packets according to the destination ip. I try to use iptables ...
  1. #1
    Just Joined!
    Join Date
    Oct 2010
    Posts
    7

    port redirecting

    Hi,

    I am running my application that include many servers.
    I want to modify the destination port of receiving packets according to the destination ip.
    I try to use iptables but the problem is that when I redirect the port it also modify the destination address.

    Is there other way to do this ?
    If not can I recompile the iptables/netfilter code to not change the destination address ? Where in the code I should do that ?

    Thanks

  2. #2
    Just Joined!
    Join Date
    Nov 2010
    Posts
    4
    Quote Originally Posted by idan72 View Post
    ...I want to modify the destination port of receiving packets according to the destination ip.
    IIRC, you should be able to do this within the setup program on most routers;

    Just tell it that anything coming in for XXX.XXX.X.XXX[optionally + port#] should really be forwarded wherever you tell it.

    Cheers,
    Ian

  3. #3
    Just Joined!
    Join Date
    Sep 2006
    Location
    Norfolk Island
    Posts
    31
    iptables can do it.

    If you post your iptables rule it would help, I presume you are trying something like this

    Code:
    iptables -t nat -A PREROUTING -i eth0 -p tcp -s 1.2.3.4 -d 5.6.7.8 --dport 80 -j DNAT --to 5.6.7.8:8080
    cheers

  4. #4
    Just Joined!
    Join Date
    Oct 2010
    Posts
    7

    port redirecting

    Hi,

    I have 20000 servers on my machine so if I want to use nat I need to write 20000 line in iptable. Is this possible ?

    I prefer to use the redirect option but the problem is that the destination address is modifing. Is there a way without modify the dest address using iptables or something else ?

    Thanks

  5. #5
    Just Joined!
    Join Date
    Sep 2006
    Location
    Norfolk Island
    Posts
    31
    No. IPTables is not your solution, better code is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...