Strange firewall behaviour

EuroEager2008 171 Reputation points
2020-11-17T16:56:08.33+00:00

I made the simplest ftp server by TcpListener (.net 5), listening at port 21 on the loopback address, opened tcp port 21 in case that should metter on a loopback connection.
Tested by another console by telnet (127.0.0.1 21) and sending "manually" active ftp commands like USER, PASS, CWD and TYPE, all works fine until the telnet client sends PORT followed by space and some numbers according to protocol, then the server hit an IOException stating that connection was closed by the client.
(PORT has to be followed by at least one space to fail).

After struggling around I was hinted by a colleague to turn off the windows firewall and voila, working fine.

I changed the server to listen on the real IP addresss of the adapter and ran the client on another machine and the firewall on the client machine had to be turned off as well (!!!)

Please note that using another port than 21 fixes the problem even with the firewalls turned on.

How can this mystic wizardry be configured away?
(The real client in question is a very old system before the era of passive mode ftp and therefore needs to issue the PORT command and only on port 21, cannot be configured)

Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
2,884 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Candy Luo 12,701 Reputation points Microsoft Vendor
    2020-11-18T07:38:32.94+00:00

    Hi ,

    Please understand, we are not familiar with FTP. We can only provide some general suggestions here.

    Please make sure port 21 is open on both sides of the communication channel. Enable both inbound and outbound 21 ports on your clients and then see if the issue is still occurs.

    For your reference:

    Revisiting FTP Basics

    Best regards,

    Candy

    --------------------------------------------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. EuroEager2008 171 Reputation points
    2020-11-18T08:41:24.887+00:00

    It still occurs.
    (If the setup wasn't like this I wouldn't be able to ask the question in the first place, pls note that, in general, textlines (commands) sent from client to server reaches the server, so far I have only seen that lines starting with PORT<SP> (or port<SP>) are leading to a disconnection).

    So all I do is according to your Revisiting FTP Basics reference and as far as I can see this problem is in the windows firewall which seems to be reacting on special text(s) in a hardcoded manner (but only when port 21 is used seemingly)

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.