Find the answer to your Linux question:
Results 1 to 3 of 3
I have a eth0 ( outside ip ) and a eth0:1 ( lan ip/192.168.0.x ) I want to take all 8080 traffic from out side and direct it to 192.168.0.21:8080 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2010
    Posts
    3

    need iptable help forwarding ip.


    I have a eth0 ( outside ip ) and a eth0:1 ( lan ip/192.168.0.x ) I want to take all 8080 traffic from out side and direct it to 192.168.0.21:8080

    I tried

    Code:
    iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 8080 -j DNAT --to 192.168.0.21:8080
    and figured I may need

    Code:
    iptables -A FORWARD -p tcp -i eth0 -d 192.168.0.21 --dport 8080 -j ACCEPT
    but its not working. What did I do wrong? Do I need to do anything with apache2 as it shows the default it works page on 8080.

  2. #2
    Just Joined!
    Join Date
    Aug 2010
    Posts
    3
    Well I made it work on 3000 like so.


    Code:
    iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 3000 -j DNAT --to-destination 192.168.0.21:8080
    iptables  -A INPUT -i eth1 -p tcp -m tcp --dport 3000 -j ACCEPT

  3. #3
    Linux Guru Lazydog's Avatar
    Join Date
    Jun 2004
    Location
    The Keystone State
    Posts
    2,677
    Now look at the 2 setups and see what is different between them. Then make sure what ever program you have listening on 808 is also listening on the 8080 on the ip address you want to redirect to.

    Regards
    Robert

    Linux
    The adventure of a life time.

    Linux User #296285
    Get Counted

  4. $spacer_open
    $spacer_close

Posting Permissions

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