This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Port forwarding

Is there an esier way to port forward? Astaro is such a great product, but truly most of this stuff is so far over my head that i'd need an airplane ticket just to get it in sight! 

I tried to portforward ftp from the external interface to an internal machine using some of the suggestions i've gotten here in the news group, but i can't seem to make it work. 

I did just as the last topic poster did. 

Maybe Astaro should create a faq or a doc sheet on their documentation repository with some very specific examples of port forwarding setup (the ones up there now are very lacking) 

I also noticed that Astaro CM does portforwarding from a pretty interface, would that be a motive to make ASL harder so you bought CM?   


This thread was automatically locked due to age.
Parents
  • the strangest hting happened, a second ago it wouldn't let me post kept complaining that my hostname was invalid, i also got email returend to me i snt that was tagged as spam, i wonder if someone is hijakking our ip here at work? 

    Thanks for the document title, i'l read it this weekend. I have been using unix for about 10 years, and linux for about 7, i understand the basics of how things work, and i can usually fix what is broken. I am more on the application/ardware side of things though i am by no means a network/ip guy [:)]t work. 

    Here is what i've done: I followed the instructions verbatim in this post: 

     [ QUOTE ]
     LKraven
    stranger

    Reged: 09/06/03
    Posts: 18

    Re: Port Forwarding? [Re: saywhat]
          #30332 - 09/18/03 08:09 PM 
    Edit    Reply    Quote  

    Port forwarding for hosting services is done like this:

    1. Define the internal host as a network with a 32 bit netmask in the definitions screen.

    2. If applicable, alias the appropriate public IP to the internet interface.

    3. If necessary, define the service port(s) in definitions. A lot are already set up by default.

    4. Set up DNAT pointing as follows:

    Match source no match.
    Match destination public IP you wish to listen on.
    Service set to the service you wish to listen for as defined earlier in definitions.
    Change source: no change.
    Change destination: set to the internal ip previously defined.
    Change service: no change.

    That will do the port forwarding. The last step is to go to the packet filter and set:

    From: Any (If you want it to be "publicly" available).
    Service: Previously defined service.
    To: Internal IP of the machine hosting the service.
    Action: Allow.

    That should take care of "port mapping" for you. 

    [/ QUOTE ] 

    And it didn't work. 

    Currently i have a rule any>any>all>allow in packet filter (fought w/ it for an entire weekend and i couldn't get it to work securely, i had to have my smoothwall setup in tandem so i can go out on the internet and get info on how to make it work). 

    It just seems to me to be overly difficult in this day and age, i mean look at smoothwall and clark connect. I've used both of those and it's brain dead hell even  I could make it work. 
    Hell i've been doing masqing since the 2.0.35 kernels and protfw using iptools [:)]t. 

    I know it's me i know it's not the product, others use it so i know i can too, but man .. why do dam hard and why no specific explicit examples of a standard home user setup step by step in their dox? it would seem to me to be a really useful thing to have no? 

    BTW thanks for the reply and this product is really great the people who worked on it should be proud they did an amazing job!   
  •  [ QUOTE ]
    I just bumble through until i can figure it out and make it work

    [/ QUOTE ] ... dont we all  

    Well since you are quite familiar with the ipchains/portfw and netfilter/iptables I will skip right to the ASL step-by-step part  

    I will assume that you use a 3 NIC layout with a external (EXT) interface, internal (INT) and a DMZ.
     Code:

                   ext ---- ASL ----- int (clients)
                             |
                            dmz (servers)

     

    Below assumes you have named the NICs ext,int,dmz. Just replace with the names you have choosen.
    int = 192.168.1.0
    dmz = 192.168.2.0

     1. Setting up masqeurading for clients 
    a) There should'nt be any need to define the internal network since it ought to be defined as static if the int nic is configured and up.

    Network -> nat/masq
    b) Create a new masq rule under 
    Rule type: masq
    Network: int_network__
    Interface: ext_interface__

    Packet filter --> rules
    c) Create a packet filter rule to test the setup.
    int_network__  Any Any Allow

    When this works, then lock things down with some explicit rules.

    2. Setting up DNAT/SNAT for FTP Server on   DMZ net 
    If you gonna use ports other then 20/21 the FTP daemon have to allow you to staticly define the passive portrange, ie. data range. If thats not the case you have to hack the conn tracking.

    Definition --> networks
    a) Define the FTP Server
    ex. myFTP 192.168.2.10 32

    Definitions --> services
    a) Define the FTP control port 
    ex. myFTP_Control TCP 1024:65535 3333
    b) Define the FTP data range
    ex. myFTP_Data_Range TCP 1024:65535 5860:5967

    Network-->nat/masq
    c) Define the DNAT rules
    type[[:D]]NAT/SNAT
    src: Any
    dst: ext_interface__
    service: myFTP_Control
    change dst: myFTP

    Do the same fo the myFTP_Data_Range

    d) Define the SNAT rule
    The easiest way would be to SNAT all data from myFTP to the ext_interface__. But if you like to explicitly define SNAT for each service do so.

    type[[:D]]NAT/SNAT
    src: myFTP
    dst: Any
    service: Any
    change src: ext_interface__
    service source: No change   

    Packet filter --> rules
    e) Set up the packet filter rules
    Allow connections to myFTP
    From: Any
    To: myFTP
    Service: myFTP_Control
    Action: Allow

    From: Any
    To: myFTP
    Service: myFTP_Data_Range
    Action: Allow

    You can define above services as a service group as well, and set up the rule for the group.

    Allow myFTP to respond (simple rule to try things out)
    From: myFTP
    To: Any
    Service: Any
    Action: Allow

    As earlier make more explicit rules to lock things down later on.

    Now set you client to connect to the external ip[:P]ort and you may have to tell the client that the ftp server is behind NAT/MASQ. And use passive transfers.

    If things dont work use the Packet Filter Livelog for to analyze what happens...

    Hope this helps.... 
  • wow! I'm impressed i understand what is going on and why by your example. I am currently rebuilding my file server and web server. I'll do as you say and see if it works. I'll post and let you know! 

    thanks for the reply! i really really appreciate it!    
  • Not only did i understand your post but i got it to work! and not only for ftp! for webmin and ssh too !!! thank you a million times over man! thanks !!!    
  • That one is so brilliant (with the examples) it should make it's way into docs.astaro.org   Anyone with the authority to do so??  And if its OK with the Author...

    regards
    Nytelse 
  • Ajo,  

    Your reply was fantastic!  Any chance of your doing the same with a 2 NIC setup?  I have a Toshiba SG20, and I can't figure out how to add a third NIC...

    So, if you could do a port forwarding web server example using only an EXT and an INT... that would be GREAT!

    (my specific example would use port 90, since my home ISP blocks 80, 81 and 8080)

    This is all important, since I could then monitor my X10 devices while on the road....  THIS IS UNBELIEVABLY IMPORTANT!!  

    Thanks, take care...  
  • Yme:  
    sweet  [:)]

    MCT:  
    I'm flattered. Perhaps the ASL team might consider adding a SNAT/MASQ part to the Guidebook-US-ASL-V4_dnat_web-server.pdf document.

    dps:  
    I assume you allready use masqeurading for your internal network (INT) right? If so...
    MASQ is basicly a type of SNAT so if you use a 2 NIC layout with a masq rule you can skip the SNAT rule.
    Note that you can MASQ the entire INT network as well on per host base. 

    Definition --> networks 
    1. Define the WebServer 
    ex. myWebServer 192.168.1.10 32 

    Definitions --> services 
    2. Define your custom http service
    ex. myHTTP tcp 1024:65535 90

    Network -> nat/masq 
    3. Setting up DNAT for myHTTP on INT
    type[:D]NAT/SNAT 
    src: Any 
    dst: ext_interface__ 
    service: myHTTP
    change dst: myWebServer 

    If you havent set up your webserver to respond to port 90 you can translate the port as well (90 --> 80):
    Service dst: HTTP

    Packet filter --> rules 
    4. Set up packet filter rules for both inbound and outbound traffic for the myHTTP service like in the FTP example. 

    Assuming you have configured your webserver to respond to port 90 or translated the port and everything is set up right you should now be able to do:
    http://external_address_or_dns_name:90   
  • AJo -

    Thank you very much...  unfortunately I can't get this to work on my setup, although I have a very simple config. (Masq my internal network, give out DHCP, use the Cobion content filtering).  This web server would be the one new set of rules...

    Nothing wrong with your example, I just can't seem to get thru it...

    I followed your example exactly, and I've tried many other combinations...  always starting from a clean setup...  part of me thinks it's me, part of me thinks it is something with ASL... but mostly I think it is something I've overlooked.

    In the meantime, I have my HomeSeer server and the ASL box attached to a Linksys router, and the Linksys is doing port forwarding to the HomeSeer server.

    I still get the benefit of the ASL firewall, most importantly the  content filtering...

    Take care!

      
  • What does your packet filter live log and/or kernel log say?  
  • Question?  After significant testing, I realized that my port forwarding is working, from the OUTSIDE.  The problem was that when I sent to my external address from inside, it converted it to the internal address.  It then either put the packet on the outside, or for some reason the server was unable to respond.  (I can see the packet ACCEPT in the log and that the destination is changed to 192.168.x.x, but it doesn't tell me what interface it sent it to.)

    So how do I set it up so that I can get to my web server inside without using the internal address? 
Reply
  • Question?  After significant testing, I realized that my port forwarding is working, from the OUTSIDE.  The problem was that when I sent to my external address from inside, it converted it to the internal address.  It then either put the packet on the outside, or for some reason the server was unable to respond.  (I can see the packet ACCEPT in the log and that the destination is changed to 192.168.x.x, but it doesn't tell me what interface it sent it to.)

    So how do I set it up so that I can get to my web server inside without using the internal address? 
Children
  • Hi,
    if the adress is changed to 192.168.x.x it sends this packet to the interface where an ip-route is set to so if one of your asl-intefaces is in this net the packets are send to this net dirctly if you dnt know this net its going where your default-route sends it. Maybe the computer to where you have your portforwarding configured has not a masqerading rule for the answer packet than they will be not changed and with 192.168.x.x they are going outside your lan but where should the receiver of these packets should send his answers ?

    firebear  
  • Thanks Firebear.

    Next question:  What kind of rule would I set up to tell packets from the internal server headed to internal computers so they are talking back in a way the internal sender can receive them?

    Sorry, that is confusing.  If I try to access my internal server from inside my network, the packets make it to the server.  But the server's reply never gets back to the (interal) computer.  Where are these packets going? 
  • Guido666:

    1. Are you using a 3 NIC layout (with DMZ) or a 2 NIC layout?
    2. Are you MASQ the the webserver?

    If you are MASQ the webserver I would assume that the response from the webserver is not translated since the request comes from a internal address. This will couse the requesting host to ignore the packets since it is expecting a reply from the external address witch it was addressing. 

    If you suspect something like this you may wanna try to SNAT instead. Witch I recon always translates the address.

    Another issue would be the usage of DNS on a 2 NIC layout, but lets get back to that if its a problem  [:)]