Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Before we get started, you may want to refer to FTP Connections and Firewalls, a node I wrote a while ago, for details on active and passive mode.


There are four scenarios:

1) Neither end is behind a firewall.

2) If the client end is firewalled,
you need to use passive mode, and
the firewall must allow outgoing connections to and from random ports.

3) If the server end is firewalled,
you need to use active mode,
the firewall must allow incoming connections to port 21 from random ports, and
the firewall must allow outgoing connections to and from random ports.

4) If both ends are behind firewalls, you screwed.

Alternatively, all of the above can potentially be solved by running a FTP proxy on the firewall may be an alternate solution. I'm not very familiar with their workings, but I could take an educated guess if you desire.


There's two reasons for the above.

1) FTP servers/clients usually use a random (i.e. system provided) port for the server end of the data connection (i.e. client for active, server for passive), which is a big no-no for firewalls.

2) FTP sends an IP address in the data stream, which is a big no-no for NAT. [*]

They both prevent a sever behind the NAT router from using passive mode, and they both prevent a client behind a NAT router from using active mode.

Some NAT routers compensate for this in part or in whole. For example, the Linksys BEFSR41 (4 port wired NAT "router" switch) fixes active mode when communicating with outside servers on port 21.

In reply to More on FTP Connections and Firewalls by ikegami
in thread Mac FTP/Firewall security question... by Spidy

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (13)
    As of 2019-11-18 16:33 GMT
    Find Nodes?
      Voting Booth?
      Strict and warnings: which comes first?

      Results (90 votes). Check out past polls.