This course has been updated! We now recommend you take the Full Stack for Front-End Engineers, v3 course.
Transcript from the "Trace Routes Practice" Lesson
>> Jem Young: So let's try another exercise. Let's try trace routes. I love trace routes. So whenever I put man something, that's just for your own information. Just so you know that I'm not just giving you random commands, cuz that's what this day's all about. I want you to have context on what we're doing.
[00:00:18] A lot of what we learn today, you can learn from a tutorial or you can look it up on Google or something like that. But I wanna give you all the context and allow you to ask questions and not just type in arbitrary commands. So if you wanna run traceroute, just run traceroute google.com.
[00:00:33] And I'll go ahead and do that here. Clear, google.com. And of course, the side benefits classes, I wanna make you look cool. So if you're just at a computer and trying to impress someone, just run traceroute something. And it makes it look like you're doing all this really cool stuff.
[00:00:53] But all we're really doing is instead of ping, which goes directly to this, it hits a server that comes back and says, hey, I'm alive. Traceroute gives you a map of every single hop along that point. Remember, how I said the Internet's built on trust in servers, and nodes, and switches?
[00:01:10] That's what we're doing. It's mapping the path of every single server that we hit along the way. So every time you see another hop, and a hop is just from one to two, two to three, three to four stuff like that. It just says, hey, I'm at 192.168.3.1.
[00:01:29] I'm trying to get to 126.96.36.199. How do I get there? So every single hop the server's like, I don't know, but this person knows. I don't know, but this person knows. And eventually it just gets passed along, passed along, passed until we end up on the actual Google server, which is here.
[00:01:47] I love traceroute cuz, one, it makes me look cool. Two, it helps diagnose network problems. So again, if you have a website and your client says, hey, I can't reach your website, you can run traceroute. And traceroute will tell you exactly where the hops break down if you can't connect to the site either.
[00:02:06] So it could be a hit here which will be 192, it's generally, .168 is your local network almost always. And it hits here, cogento cogento said that, is that an ISP? Didn't know, different part of the country, but that's hitting the ISP and that's trying to resolve-
>> Speaker 2: Cogent is our ISP.
>> Jem Young: Cogentco, [SOUND] cogentco, that's a good name. All right, but essentially, let's say the hops died here at number two. That means the ISP is not resolving, and you know something's just out in general. Versus if we get further down, we get closer to the Google resolver, as we get closer and closer to the actual server, and it dies out.
[00:02:49] We know that it could be a load balancer that's out, it's probably Google itself. Trace route is very useful for that if you're trying to determine what's wrong with your site. Again, it's just this thing to have in your back pocket. And an example of, when I did it at home, it was much faster hops.
[00:03:06] There's actually 16 hops to get to Google, which is actually quite a bit. They're usually really, really fast. So try traceroute on frontendmasters.com.
>> Jem Young: traceroute.
>> Jem Young: Maybe, maybe it will resolve. When I tried this last time, it didn't resolve. It may resolve now. But what's happening, I'll just leave it running, switch over.
[00:03:46] What's happening is traceroute and ping are both running a thing called ICMP requests. So ICMP is Internet Control Message Protocol, instead of TCP, which is Transmission Control Protocol. This is saying, hey, these are health checks of sort. So ping is a sort of health check saying, are you alive?
[00:04:05] Traceroute is, how many hops does it take to get to the server, are you alive? And looks like it, you can configure your server to not respond to ICMP requests at all. So the same thing happens if you try to ping frontendmasters.com, it won't respond. And this is what is we call black holing.
[00:04:24] Where, if you wanna explicitly deny requests, you can say, not allowed, hey, don't do that. We're not gonna accept that. Black holing is just saying, we're not even gonna respond to your requests. If you had a party and you see a cool person and they just ignore you completely.
[00:04:39] That's kinda black holing. That never happens to me, ever. I was the cool person at the party. We're sharing a lot of information today, [LAUGH] we got a long way. We're gonna get to know each other by the end. So frontendmasters.com, the way it's configured is they just set their ICMP requests to one, they're just gonna ignore all of them.
[00:04:59] And that's why ping and traceroute don't work. You can configure your website to do that. Maybe you don't wanna get pinged to death, which usually doesn't happen anymore. But in the old days of the Internet, you could take down a site by pinging them. I can set up five or six servers and just keep pinging, pinging, pinging, and because every ping, the computer is obligated to respond to you.
[00:05:17] You can take down a website before, this is the old days, now it won't work anymore. But it would just overload the server with requests. And you may wanna disable that for your server, you might not want to. I usually keep it alive. It's good for debugging, so I can ping my own website.
[00:05:33] I can run traceroute on it, but sometimes you don't want that. And that's totally up to you, that's the great thing about running your own server, is you have complete control.