Find the answer to your Linux question:
Results 1 to 4 of 4
Hi all, I have no idea what i do wrong. Ive ubuntu 10.04 LTS desktop version. (2 times) One (let we call it [SERVER]) has 2 nics. - 192.XX.XX.XX - ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2010
    Posts
    16

    Ubuntu, Port Forwarding


    Hi all,

    I have no idea what i do wrong. Ive ubuntu 10.04 LTS desktop version. (2 times)

    One (let we call it [SERVER]) has 2 nics.
    - 192.XX.XX.XX
    - 10.0.0.100

    Two (let we call it [WEBSERVER] has 1 nic
    - 10.0.0.104
    (here is a website running)

    From my SERVER I can ping 10.0.0.100 and 10.0.0.104
    From my SERVER I can visit the website at 10.0.0.104
    From somewhere else (not in the network) I can ping 192.XX.XX.XX but not 10.0.0.100 or 10.0.0.104

    So...
    What I want is, if I browse toe 192.XX.XX.XX:4000 (randomport number) I want that i can see the website at the WEBSERVER 10.0.0.104

    What did i did
    Code:
    echo 1 > /proc/sys/net/ipv4/ip_forward
    
    iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 4000 -j DNAT --to 10.0.0.104:80
    
    iptables-save
    but I got "Failed to open page"
    What did i wrong, or didn't see.

    Greetz

  2. #2
    Just Joined!
    Join Date
    Feb 2010
    Posts
    6
    Hi Mark,

    I am not prof at iptables, but maybe I will be helpfu. Worth giving a try. Are You sure, the requests are comming from eth0 interface? Maybe it's the other one and the webserver is attavched to eth0.

    Moreover, to my opinion, You will not get ping responses, since You forward only port 4000, whereas ping works for ip addresses (I think it's not tcp/ip layer).

    Regarads.

  3. #3
    Linux Newbie user-f11's Avatar
    Join Date
    Feb 2011
    Location
    Sofia, BG
    Posts
    185
    Hi,
    So far I can understand you have a signal but do not have Internet connection.
    Call the Internet service provider and check whether everything is O.K. there (from time to time there is prophylactics).

    If the Internet service provider is O.K. try the following: right-mouse-click and select 'Hidden Internet Connection'.
    See whether your connection appears there. If YES - select it and go to the browser to test (open some famous web pages), if NO - from the desktop menu navigate to Network and make the settings, after that restart the computer WITH switched in advance router and/or modem.

    If the settings of the computer are O.K. - check the router.
    Log to the router's admin page (write the address in the browser).
    From the main page or in separate 'network status' section check whether the Internet protocols are transmitted properly.

    If the problem persists - test the computer with different network connection.

    Regards

  4. #4
    Just Joined!
    Join Date
    Jun 2010
    Posts
    25

    Smile

    Quote Originally Posted by MarkRaats View Post
    Hi all,

    I have no idea what i do wrong. Ive ubuntu 10.04 LTS desktop version. (2 times)

    One (let we call it [SERVER]) has 2 nics.
    - 192.XX.XX.XX
    - 10.0.0.100

    Two (let we call it [WEBSERVER] has 1 nic
    - 10.0.0.104
    (here is a website running)

    From my SERVER I can ping 10.0.0.100 and 10.0.0.104
    From my SERVER I can visit the website at 10.0.0.104
    From somewhere else (not in the network) I can ping 192.XX.XX.XX but not 10.0.0.100 or 10.0.0.104

    So...
    What I want is, if I browse toe 192.XX.XX.XX:4000 (randomport number) I want that i can see the website at the WEBSERVER 10.0.0.104

    What did i did
    Code:
    echo 1 > /proc/sys/net/ipv4/ip_forward
    
    iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 4000 -j DNAT --to 10.0.0.104:80
    
    iptables-save
    but I got "Failed to open page"
    What did i wrong, or didn't see.

    Greetz
    add this rule also
    iptables -t nat -i eth0 -A POSTROUTING -j MASQUERADE
    hope it will work

Posting Permissions

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