Full Stack for Front-End Engineers, v3

View Open Ports with nmap

Jem Young

Jem Young

Full Stack for Front-End Engineers, v3

Check out a free preview of the full Full Stack for Front-End Engineers, v3 course

The "View Open Ports with nmap" Lesson is part of the full, Full Stack for Front-End Engineers, v3 course featured in this preview video. Here's what you'd learn in this lesson:

Jem discusses ports, how to view a list of well-known ports, and walks through installing and using nmap to view open ports.


Transcript from the "View Open Ports with nmap" Lesson

>> So we're talking about security. We talked about SSH, we talked about firewalls. We talked about the importance of keeping your software up to date. We talked a bit about two factor authentication that doesn't really come into play as much on the server. And we talked about the VPN.

And a VPN is a virtual private network, which allows you to say like, hey, I trust all these devices, but within my network we're gonna throw all these massive walls and barriers. To make sure that nobody outside can get it and we make it really really onerous to try to break into our network.

That way it cuts out on kind of the negotiation, you have to have security where security is always wants to lock things down. Where's you as Sin engineer while access to things. So it's always a trade-off for making constantly. And before getting the firewalls, we have to understand what a port is.

A port just is a communication and point that maps through specific processor network service. Ports are amazing because we talked earlier about the IP addresses and how there's a finite number of IP addresses. But even so, without ports, we'd run out IP addresses much faster. So a port allows us to have multiple services on one IP address, even thaosands of services on one IP address.

Now if you wanna see the well known ports, and there are some ports that are usually reserved or well-known, we can take a look at those. So we'll say less. And we're using less here because it's a lot. So we wanna go through slowly. Any familiar ports in there?

SSH, 22, yeah, it's usually reserved for SSH. Now, more of my old school people out there know what FTP is, Port 21, very familiar. Telnet, yeah, that's a throwback. I think it still exists, but I don't know if it's worth going into in this class. Let's see, look at that, port 80, the most popular port in the world.

That's what the Internet runs on, is port 80 in your browser. Not a lot of people know that. And I won't go through the whole thing because it goes and goes and goes and goes and goes and goes and goes and goes. But these are all well-known ports that other companies or general practice they tend to use.

You can still use them but you run into something called a port collision? If there's already another port, that's why we usually use port 3000, that's not reserved for anything. We use port 8000 or 8080, something like that. But really there's thaosands and thaosands of ports, if your odds of running to collision if you pick a high enough number, you're usually pretty good.

Port 443 HBS, yeah, that's what the Internet runs on. So, ports are an opening in your computer. So you can't connect to your computer without some sort of port. You connect to an IP address that doesn't really tell you anything, you have to give it a port as well.

Ports and open ports are one of the more I won't say dangerous, but things you have to be aware of. So let's take a look at our open ports. We're gonna use a program called nmap. So sudo apt install nmap and you can do this on your machine, you can do this on your server, it actually doesn't matter.

And then run nmap against your droplet's IP, and it'll give you a list of your open ports. All right, let's do it together. So for this one, I'm actually gonna do it on my local machine, I think I have nmap installed, I do. Make that bigger. So I need my droplets IP and I have not used this droplet enough usually over time I can memorize it my IP address but it's been a while so let me pull this one up here and get my IP address I'm just going to run Nmap against my server, and it'll tell me which ports are open on my droplet.

Let me just clear that out so it'll be a little easier to read. And there, it's showing the ports that are open on my server, right now, port 22. What's port 22?
>> SSH.
>> SSH so port 22 is always gonna be open. Port 80? What's port 80?

>> HTTP.
>> HTTP, yeah, it's always gonna be open as well. Port 3000, why is that open?
>> Node.
>> Node, that's right. But it shouldn't be open, because we don't need port 3000 to be open, because nginx is actually intercepting all those. So we only want requests to port 22 for SSH, port 80.

So what we need to do is close port 3000, which opened by default, because our node server opened it up. So let's talk about how to do that.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now