Results 1 to 8 of 8

Thread: Port forwarding woes

  1. #1

    Port forwarding woes

    No matter what i try i cant seem to get fort porwarding working so i can have my web server on 192.168.0.197

    have setup like this

    (cloud)---[ppp0{linux}eth0]--------[192.168.0.197]

    all default rules in iptables set to ACCEPT

    2 rules in place

    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    (so i can access the net from internal side)

    and

    iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 192.168.0.197:80
    (hoping to forward port 80 requests to web server)

    When i try to access my web page from either machine i get a message from mozilla saying connection refused. This message also comes up if there is no web server running when connecting to http://192.168.0.197 so i gather its is not refused but not to be found.

    If i am running the web server i can connect by http://192.168.0.197.

    Anyone ever got this to work? Can you see what im doing wrong?
    Its better to regret something you have done than to regret something you havent done :P

  2. #2

    Re:Port forwarding woes

    yea ignore those links - that is what im just typing into my browser
    Its better to regret something you have done than to regret something you havent done :P

  3. #3

    Re:Port forwarding woes

    See this page wasnt on the recent posts so i updated it to put it there, coz thats the one that matters.
    http://www.getlinuxonline.com/yabbse...;threadid=2110
    Its better to regret something you have done than to regret something you havent done :P

  4. #4

    Re:Port forwarding woes

    Now have you looked at your log to see if it is actually refusing your connection through the log or whether it is experiencing some kind of other error?

    Aragorn
    If you give a man a fire he'll be warm, if you light the man on fire he'll be warm for life.

  5. #5

    Re:Port forwarding woes

    What is your external IP? I would like to try connecting to your webserver. To me it looks like you have your IPTABLES correct. Are you trying to access your webpage with your external IP or your internal IP?
    AMD Athlon 2200+ 1.8Ghz
    1280MB PC-3200 CAS2.5 RAM
    ATI Radeon 9600 Pro 128MB AGP
    Western Digital WDC WD2500JB-00FUA0 250GB 7200 rpm ATA/133
    Seagate ST3200822A 200GB 7200 rpm ATA/133
    Western Digital WDC WD1200BB-00CAA1 120GB 7200 rpm ATA/133
    Western Digital WDC WD800BB-00CAA1 80GB 7200 rpm ATA/133
    Maxtor OneTouch 2HA43R32 1TB 7200 rpm USB 2.0
    D-Link DFE-530TX+ 10/100 NIC
    D-Link DWL-G520 Rev.A
    Debian 5.0r1 Lenny

  6. #6

    Re:Port forwarding woes

    Might be hard to connect to the web server - its not always up,im just doing this for learning purposes. And its on a 56k dial up which gets disconnected every 4 hrs.
    Would be useful if i could VNC into someones computer and then try to look at it from there, but whos gonna let me do that LOL

    Anyway im trying to connecting with the external ip address, I am using dynDNS so im actually typing in the domain - not the ip. Except when i try it internally (192.168.0.197)

    Maybe because im trying to access it from the internal side that its giving me probs? Dont see why this should happen though.

    Now have you looked at your log to see if it is actually refusing your connection through the log or whether it is experiencing some kind of other error?
    You know what,i have never really used logs, im not sure where to start - where are they?
    Its better to regret something you have done than to regret something you havent done :P

  7. #7

    Re:Port forwarding woes

    I think that is the reason you are getting problems. I believe there is a different way to setup IPTABLES for LAN to LAN access.

    This is a redirection hack that should work, but perhaps there is a better way still.

    $IPTABLES -t nat -A PREROUTING -d $EXTIP -p tcp --dport 80 -m state --state NEW,ESTABLISHED,RELATED -j DNAT --to 192.168.0.197

    When your $EXTIP changes your going to be hurting again. I'm not sure if you can put your dynDNS in stead of a real IP, but you can try.
    AMD Athlon 2200+ 1.8Ghz
    1280MB PC-3200 CAS2.5 RAM
    ATI Radeon 9600 Pro 128MB AGP
    Western Digital WDC WD2500JB-00FUA0 250GB 7200 rpm ATA/133
    Seagate ST3200822A 200GB 7200 rpm ATA/133
    Western Digital WDC WD1200BB-00CAA1 120GB 7200 rpm ATA/133
    Western Digital WDC WD800BB-00CAA1 80GB 7200 rpm ATA/133
    Maxtor OneTouch 2HA43R32 1TB 7200 rpm USB 2.0
    D-Link DFE-530TX+ 10/100 NIC
    D-Link DWL-G520 Rev.A
    Debian 5.0r1 Lenny

  8. #8

    Re:Port forwarding woes

    you were right the internal lan is the only place i cant get to it from. I set up the server then went to work and i could see the web server - yay!

    now to figure out how to get asscess from inside - ill work on it a bit more.

    And Skynet you can type in FQDN in iptables, but it just translates it to ip addresses so you would want to run your iptables script everytime your ip changes.

    or if you are using iptables save then you are in trouble.

    Thanks guys
    Its better to regret something you have done than to regret something you havent done :P

Similar Threads

  1. Port forwarding without ssh
    By countach44 in forum Linux - Hardware, Networking & Security
    Replies: 3
    Last Post: 01-10-2005, 10:13 PM
  2. SSH port forwarding
    By crazy ivan in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 10-07-2003, 11:10 PM
  3. ssh port forwarding
    By Blaqb0x in forum Linux - Hardware, Networking & Security
    Replies: 5
    Last Post: 02-10-2003, 05:15 AM
  4. Port Forwarding FTP with NATD
    By Coral_Sea in forum BSD
    Replies: 4
    Last Post: 01-29-2003, 10:55 PM
  5. Port forwarding
    By Schotty in forum Linux - Hardware, Networking & Security
    Replies: 5
    Last Post: 11-29-2001, 05:08 PM

Bookmarks

Posting Permissions

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