 Okay, today we're going to be looking at IP tables, so let me give you a rundown on what prompted this tutorial. A couple of weeks ago I was out at the park with my family and I realized I had to do something on my web server, my Films by Chris server, so I went to SSHN and nothing happened. I, you know, typed in the SSH command and never asked for a password and just kind of sat there. I just hung. I was like, oh, that's not good, it's my server down, so I went to Films by Chris .com in the web browser and it was working fine, so I'm like, okay, maybe SSH server crashed, so I went to the virtual machine settings and restarted the whole machine and still same thing and then I realized, oh, well, I had connected to some open Wi-Fi from a nearby school and apparently they must be blocking port 22, which is just silly because that's easy enough to get around. I was actually able to get around it because I actually have some port forwarding going on on my Pogo plug at home since I'm running multiple servers here, so I had it running on a different port. I could SSH into that and then pivot to my Films by Chris server from there, but I'm going to show you how to do different port forwarding now. Port forwarding probably might be familiar with it, especially if you do SSHN to your machine at home in your router settings where you go in and you say, okay, when something comes in at this port to the router, we're going to redirect to this machine. That's what we're going to do today. We're going to be using IP tables, which is a program that allows you to basically do set up rules for your network, but instead of redirecting to another machine, we're going to redirect to the same machine, but to a different port. So I am going to copy and paste this command because I actually already tried recording the tutorial twice and I kept typing things wrong. I will give links to notes in the description and if they're not there, remind me because sometimes I forget to put those there. But you're going to have to be pseudo root. So we're going to say pseudo, IP tables, and we're going to do dash T, whoops, dash T net, dash I, we're doing some pre-routing, dash P, we're going to be using a TCP protocol, dash dash D port 22222 or 22222. And that could be any number you want. That's within the range of IP addresses. I would not use 2222. I'm just using that in the example here. I would pick a higher number that is not commonly used that you can remember. So the reason I would not pick 2222 is because I've seen servers. For example, I used to host films by Chris using HostGator, and their default SSH port was 2222. So I would say that it seems like it might be commonly used. So there's a good possibility that it might be blocked as well. So just pick a higher number that you can remember that's in the range of ports, which is 65,000 something, I think is the highest number. Anyway, next we're going to say dash J, and we're going to redirect to ports 22. So that's our first command. We ran that successful. Everything's typed properly because I copied and pasted it rather than typing that all out. Next command is another IP tables dash T, NAT, dash output, dash P, still TCP protocol, and then dash O, LO. So LO is your basically local network interface. Real quick, I'm going to control C on that command. I'm going to do Nmap, sorry, Nmap local host real quick. I just, I should have meant to show you this before. So port 2222 is not open, but if I if config, you'll see that I have my Ethernet card, and then you usually have this low interface. Low interface is a loopback interface. It's basically like a virtual interface. Even if you had no network cards, you'll have a low interface. So basically it's just saying we're coming in on port 22, and we're going to loop back to the same machine. So again, let me copy and paste. So we're saying use the loopback interface to redirect port 22 to port 22 to port 22. Now I hit enter. So we've run those two commands. So again, this is the first command here, and then this is the second command here. Again, I'll try to put those in the notes. And now if I Nmap local host, you'll see that we have port 2222 open. And you notice that it does have a name here, which means a service here. That this port might be used by other servers. I don't know what Ethernet IP-1 is, but the fact that it has a name means that that port does have a commonly used purpose. So if you're seeing that, it may not be the best port to use. But now I can do SSH local host. And that would be normal. I hit that. It goes to port 22 like it normally would. But I can also say dash P2222. And again, it brings us to our local host. So basically just forward port 22. Let's run that again. Let's run this command here, but change this to port 2221. And then the second command here, 2221. And now if I really quick Nmap local host, you notice it doesn't show up again. When you just run Nmap like this, it's doing a quick scan of commonly used ports. So it's not scanning every port. But if I tell it specifically to scan port 2221, you'll see that it does tell me that it's open. And its service is normally a Rockwell-CSP1. So just to be aware of that, you may not see that port being used. So that just shows that port 2222 is probably commonly used since it's in the commonly scanned ports. Anyway, I can SSH local host port 2221 and connect port 2222 or just port 22. So all of them are actually going to port 22. So now if port 22 is blocked, it doesn't matter because I am reconnecting to it through a different port that's just forwarding to the other port. Clear as mud. Again, I will put those commands in the link in the description. But for now, I will also just, for your convenience, put them up on the screen here, right there. I will leave them up there while I talk here for a moment. I just want to say thank you for watching. I hope you found this video useful. I hope that you enjoy my videos. If you do, think about visiting films by chris.com. That's Chris Decay. There's a link in the description. Check that out. There you can search through all my videos. There's also a link there to search through my scripts. And this is actually in my notes. So when you go there, it will bring you to a little website that will load up a list of my scripts. It's actually very poorly written. It actually loads up every single script from my Payspin account into the HTML of the page. And then it searches through that. So it's a little slow. As I add more, I really should have it search the database and then just output where you're searching. But anyway, so filmsbychris.com, you can search through my videos. You can search through all my scripts. If I do forget to put this code, a link to this in the link in the description of this video, remind me. But it is in my notes. So filmsbychris.com, click on Scripts. And that should bring you to a little search where you can search through all my notes and just type in IP tables. I don't have very many notes on IP table. So you should be able to find it there. So if you have anything about supporting, patreon.com. There's a link to that in the description of this video, also on my website under the Support section. You can also support me through PayPal. I do want to thank you for watching. And as always, I hope that you have a great day.