Submind YouTube summaries
Thumbnail for Getting Your Pubilc IP Address

Getting Your Pubilc IP Address

Watch on YouTube

Video summary

This video explains the concept and utility of public IP addresses, distinguishing them from local IP addresses assigned by routers to devices within a private network. While a local IP is essential for connecting to computers on your own home network, your public IP address serves as the unique identifier for your entire network on the internet. Understanding this distinction is crucial for tasks such as running remote servers or accessing home computers from outside your local network, as these operations require knowledge of your public-facing address. The presenter demonstrates several practical methods for retrieving this information, ranging from using third-party websites that echo back the visitor's IP to utilizing command-line tools like wget or curl. A particularly useful approach highlighted is creating a simple PHP script on your own web server that outputs the remote client's IP address via the $_SERVER['REMOTE_ADDR'] variable. By hosting such a script at a specific URL, you can create a permanent, easy-to-remember link that provides your current public IP address in plain text whenever anyone visits it. However, the video notes that public IP addresses are not static and can change frequently depending on your Internet Service Provider (ISP). The speaker shares his experience with Comcast, noting that while changes used to happen often, they now occur only occasionally after network outages or updates, though other ISPs might change addresses daily or even hourly. To manage this volatility, the presenter describes setting up automated scripts that run periodically to check for IP changes and update a domain name accordingly, or alternatively, sending text notifications when an address shift is detected. Ultimately, the video concludes by emphasizing the importance of having your own method to track your public IP address rather than relying solely on external services. Maintaining a personal script or dedicated page offers significant advantages, such as easier memorization and real-time awareness of location-based data that ISPs can use to pinpoint your connection within a few miles or blocks. The presenter strongly recommends setting up this functionality yourself, as it ensures you always have accurate access to your network's identity regardless of how often your ISP decides to change it.
Read the full video transcript
Hello, and welcome to a video from filmsbychris.com. That's Chris with a K. I'm Chris with a K. Today, we're going to be looking at your public IP address. Well, not specific specifically yours, but you will be able to look at yours. Your computer and anything on your network gets an IP address handed to it from the router. This is my local IP address. If I want to connect to this computer from another computer that's on my local network, this is the IP address I need. But, you also have your public IP address, which is the IP address that leads to your network. So, if you want to run a server and connect to your computers at home remotely, you're going to need to know your IP address. And there's different ways you can do that. You can use wget or curl. And there's lots of websites out there that will just echo out the IP address you're connecting from. So, here's an example. Here's an example. Here's an example. Oh, that's the same one. And here's an example. There's also ifconfig.me. There's a bunch of them out there. This is great, but can we do it ourselves? Well, if I was to come up here and go filmsbychris.com, I'm going to give this a dash L because my website does some forwarding. I get my IP address. I can also uh I think that should work, too. No, I think I still need the L for that. Anyway, filmsbychris.com/myip. You can use that if you want. You can curl it just like I did. But, let's see how we do that. Go to my web server. This is my web server right here. I'm in my web directory. This is the PHP file. This is it. This is a variable that is the client that's connected to the server. It's the remote address. It's their address, and we're just echoing it back. That's all we're doing. That's all you need to do. So, if you have a web server running PHP, this is all you need to do to echo out the IP address. And obviously, we're only working with IPV4 here. Um and now anybody who requests that is going to get that out in plain text. Uh so, that's super useful. And of course, you can use my link if you want. I'll just leave that up. Um but, you can do this on your own system. And I highly recommend you doing it. One, because it's easier to remember. Um but, also at the same time, your IP address isn't private information, but it's still information about you. With your IP address, I can tell within range, within a couple of miles, where you're connecting from, unless you're going through some sort of proxy server, right? Um which is not a big deal, but I can know that, you know, you're in Orlando, Florida, and even like within a couple of blocks of Orlando, Florida. Uh and we can look at it doing that, figuring that out in with a script in a future video. Uh but you know, if you can do stuff yourself, do stuff yourself. Uh so, I have it up on filmsbychris.com. My personal IP address, my my public IP address for my home network, I have Comcast. I do not have a static IP. You can pay for an IP address that never changes. Uh I personally don't, but in the last 5 years, Comcast has changed my IP address maybe two or three times, and it's usually after long outages when they're doing uh network updates in the area. So, it doesn't Back in the day, it used to change all the time. Now, it very rarely changes. But your ISP might change daily or even hourly. Well, if you have a server that you can access all time, like I have filmsbychris uh for my web server, I have a script at home that runs every couple of minutes, grabs my IP address, and updates the domain that I have for my house, and also uh before I had a domain pointed towards my house, I uh used to have it where if the IP address changed, it would just text me. It didn't happen all the time, but I'd get a text, "Your IP address changed. This is the new one." And then I could also, if I was to SSH in, I could do like SSH and then for the IP address, I would just do like uh curl, and I would run that curl command, you know, to filmsbychris.com. Uh well, no, that doesn't make sense. What I'm saying doesn't make sense. >> [laughter] >> Uh I actually had another script on my server that would actually uh when I updated, it was my own personal uh PHP file, and when I connected, it logged that, and I would be able to call that from Films By Chris and get my home IP address. And it would update regularly. I hope that makes sense what I just said. But, my point is, one line, one variable can get you your IP address if you have a server that you have access to. This is a great thing to have. Um just lets you constantly keep track of your IP address. Thanks for watching, as always. I hope that you have a great day.