How to Use Netcat to Listen on a Port

Sharing buttons:

hello Brian Reid here with firewalls

comm this video request comes from a

customer who wants to know how he can

test to make sure that his firewall is

allowing data to ingress flow into the

firewall to a specific service on a

server inside his network without having

that server online for example in this

case we want to test to make sure that

the firewall is allowing FTP access to

our server on the inside of the network

all right to do this testing we're going

to use a tool called netcat we'll put

information as to where you can find

netcat and download it it's a free tool

you can run it on Windows Linux it's a

very versatile troubleshooting tool when

you want to nitpick little scenarios

like this so to begin we're going to

simulate a server an FTP server running

on port 21 and to do that with netcat we

type in NC then the - L so that we're

telling that cat - listen we'll do a - P

to talk to listen on a port and in this

case we'll do port 21 which is for FTP

now when you press Enter the cursor is

just going to sit there and blink at you

this means that netcat is running and is

listening on port 21 now we'll switch

over to another machine and we will run

the telnet command - the IP address and

port number that we have the netcat

installed so depending on where you want

to test this from you can do it

internally you can do it outside your

firewall as well so in this case for the

demonstration I'm just going to show you

here on the local machine so here's how

we test it we do a telnet and you want

to type in the IP address of the host

that's running the netcat tool so in

this case we're just running it locally

then a space and then put in the port

number so we'll do 20

now we'll see that the telnet screen

goes blank but if we start typing some

characters you will see over here on the

left hand side where netcat is running

it's showing us what we're typing so

this is a great way to test to see if

your firewall will allow access to a

server on a certain port ok we hope you

find this video useful if you got any

questions or comments please put them in

this section below have a great day