Learning Library

← Back to Library

Understanding NAT and Firewalls

Key Points

  • NAT (Network Address Translation) converts private internal IP addresses to public internet addresses, conserving the limited pool of globally routable IPs.
  • An apartment‑building analogy illustrates that while apartment numbers (private IPs) can repeat, the street address (public IP) uniquely identifies a location worldwide.
  • NAT devices are typically implemented in routers that bridge internal networks to the internet, translating traffic from internal to external address spaces.
  • Firewalls are often integrated with NAT routers to enforce security policies, controlling which inbound and outbound traffic is allowed between the private network and the public internet.

Full Transcript

# Understanding NAT and Firewalls **Source:** [https://www.youtube.com/watch?v=2llWuivdS7w](https://www.youtube.com/watch?v=2llWuivdS7w) **Duration:** 00:09:23 ## Summary - NAT (Network Address Translation) converts private internal IP addresses to public internet addresses, conserving the limited pool of globally routable IPs. - An apartment‑building analogy illustrates that while apartment numbers (private IPs) can repeat, the street address (public IP) uniquely identifies a location worldwide. - NAT devices are typically implemented in routers that bridge internal networks to the internet, translating traffic from internal to external address spaces. - Firewalls are often integrated with NAT routers to enforce security policies, controlling which inbound and outbound traffic is allowed between the private network and the public internet. ## Sections - [00:00:00](https://www.youtube.com/watch?v=2llWuivdS7w&t=0s) **Explaining NAT with Apartment Analogy** - The speaker defines Network Address Translation, explains why private IP ranges are needed, and uses an apartment‑building metaphor to illustrate how internal addresses map to unique external internet addresses. - [00:03:06](https://www.youtube.com/watch?v=2llWuivdS7w&t=186s) **NAT Explained with Mail Analogy** - The speaker uses a house‑mail metaphor to describe how a NAT device translates internal IP addresses to public ones and tracks responses back to the originating apartment. - [00:06:11](https://www.youtube.com/watch?v=2llWuivdS7w&t=371s) **Lock, Guard, and Inspector Firewalls** - The speaker uses an apartment analogy to contrast simple lock‑based (static) firewalls, stateful firewalls that track source‑destination sessions, and application firewalls that inspect deeper into the traffic. - [00:09:15](https://www.youtube.com/watch?v=2llWuivdS7w&t=555s) **Call to Action Closing** - The speaker invites viewers to submit questions and encourages them to like the video and subscribe for more similar content. ## Full Transcript
0:00Hi, my name's Frank Chodacki. 0:02I'm part of the IBM Cloud team, 0:03and I'm here to explain some basic network concepts 0:06that are pretty ubiquitous, or universally used, 0:11and the terms are "NAT" and "firewall". 0:14Let's start off with NAT. 0:16NAT stands for Network Address Translation. 0:19It's described in an IETF RFC 1918 0:25and what NAT-ing really does is allows us to translate 0:33internet addresses to private address space. 0:38Private address space is really there because there's only a finite number 0:42of internet TCP/IP addresses. 0:45So, to cover this topic, 0:47I always find it's better to use analogies 0:49and we are going to use the apartment analogy 0:52to describe what an internal network 0:55or TCP/IP range is versus an external TCP/IP range. 1:00So, over here we have our apartment buildings, 1:03we have apartment building #1, we have apartment building #2. 1:07And, within those apartment buildings, 1:11we have apartment 1, 2, 3, 4, etc. 1:15And over in apartment building #2 ... 1:17well, lo and behold: we have the same apartment numbers! 1:23The only thing that really differentiates apartment 1 in building #2 and 1:26apartment 1 in building #1, is their street address. 1:32So, much like an internet TCP/IP address, 1:36the street address is uniquely addressable across the world. 1:41So, we have apartment #1 is, let's say, 123 1st Street. 1:51And apartment #2 is 157 2nd Second street. 2:02So, those addresses, the street address, is uniquely addressable across the world 2:07or, as the apartments themselves, the apartment numbers are not unique. 2:13So, that really describes difference between 2:15an internal 1918 TCP/IP address and an external address. 2:21Well, how do you get between those two things? 2:23You get there by something called NAT, 2:25Network Address Translation. 2:27NAT is typically used to translate an IP address 2:30from one range, or multiple IP addresses from one range, 2:34to an IP address on some other range. 2:36It's commonly used between private internal networks 2:41and an internet IP address because those are finite 2:44and subsequently, they can be very expensive to purchase or to use. 2:48So, in the case of apartment #1, 2:51we have a device that does our NAT-ing. 2:56And the second part of this topic is firewalls. 2:59A NAT device typically goes along with the firewall function 3:03and is usually employed in some kind of a routing device. 3:06A routing device connects two or more computer networks. 3:10So, we're just gonna put our firewall down here, 3:12and both are apartments here, 3:15so NAT and firewall. 3:18So, let's say someone in apartment #2 wants to communicate 3:23or send a letter, a mail (remember those, mail?), 3:27over to Company1.net 3:29and he wants to send it from his street address 3:34to the company one street address 3:36or let's just say, from his internal IP address to a public IP address, 3:41or an internet IP address. 3:43What he would do is send that out to the NAT-ing device 3:47which is akin to, let's say you have a home router, or routing device 3:51that's the first device your traffic's going to hit. 3:54The NAT, Network Address Translation, part of that 3:58is going to convert that internal address to a real internet address. 4:02Which is what? 4:04It's this 123 1st Street. 4:06That traffic is gonna traverse from 123 1st Street, 4:09so it's like sending mail with the return address being 123 1st Street, 4:14over to Company1.net. 4:17As soon as Company1.net sends a response 4:20it's going to not send it to apartment #2, 4:23it's actually going to send it to 123 1st Street. 4:27It's going to send a response back, and 4:32what's going to happen is the NAT-ing device actually keeps track of what's going out 4:36and the corresponding response. 4:39And it knows that the response to 123 1st Street, 4:43let's say it's the person's name, they put their name on the letter going out, 4:47it converts that to an internal address 4:50which happens to be apartment #2, it knows that person lives in apartment #2. 4:56Here's the key: 4:57company one doesn't know that that person lives apartment #2, 5:01all it knows is 123 1st Street, 5:04essentially obscuring the final address of that person. 5:08So, by that, it's kind of a security advice 5:11because it protects that person 5:13it's akin to a security device. 5:18Now, that by itself is typically not enough. 5:23On the same device will have a firewall function. 5:25What's a firewall function? 5:27A firewall function is known as a security device service appliance 5:31that actually monitors the network communication 5:34between the source some source and some destination 5:37typically deployed across two different networks. 5:41That's not always the case, but in this analogy we're gonna just say 5:46the firewall is there between the internal network 5:48and the external network 5:50and notice we have deployed with our NAT device. 5:52So, in a typical firewall 5:55we'll have something called a "stateless" firewall, 6:07and all a stateless firewall is, it's just like a lock on the door. 6:11So, if we put a lock over here, 6:15and we put a lock over here. All that says is, 6:20"I'm a person that wishes to get into the apartment. I have a key, and I'll open the door and go in". 6:26Well, it's not a bad way to go and it keeps most people out of the apartment building 6:32that don't live there, 6:33but somebody can tailgate and they can go in behind 6:37the traffic maybe figure out the key, 6:39there's a couple of different ways. 6:42It's a decent firewall, 6:44but as things get more sophisticated it's not enough. 6:47So, the next type of firewall that came up was called "stateful". 6:57So, stateful firewall does this: 7:02now we've hired a security guard, 7:07here's our security guard, he's a cool dude. 7:11He's sitting at that the front desk. 7:13So, as traffic tries to enter the apartment building 7:16maybe they have a key, 7:18he looks at the person and says, "Where are you going?" 7:21"I'm going to apartment to apartment 4." 7:25OK, so now that traffic's allowed to apartment 4. 7:29Doesn't ask what the person's doing there or anything else, 7:32just allows the traffic. 7:33So, really a stateful firewall 7:36understands the source and destination of the traffic 7:43and it actually monitors the conversation 7:47between that source and destination 7:49and does a little bit more 7:52being a traffic cop between those two, source and destination. 7:57So, the last thing we're gonna look at 8:00is something called an "application firewall". 8:14An application firewall is something that looks deeper the conversation. 8:17So, now we have our traffic cop over here and what he's doing is 8:22now, rather than just asking what apartment you're going to, 8:25he's going to ask what your purpose is. 8:27So, think of it this way 8:29it actually looks deeper into the conversation, 8:31if we're talking about web service traffic, 8:34it makes sure that's really web type traffic 8:38that's being communicated from the source and destination 8:41- not just some other type of traffic 8:44that could be, let's say, some kind of malicious traffic. 8:49So, in other words it's analogous to this: 8:51I have a person trying to get to apartment #2 8:55and that person says that they're there to deliver a pizza 8:59when really they're trying to do door-to-door sales. 9:02So, the security cop 9:04or security guard, in this case, would figure that out 9:07and not allow the person access to their apartment. 9:10And those are the basics of NAT-ing and firewalling. 9:13Thank you for watching this video. 9:15If you have any questions please drop us a line. 9:18If you would like to see more videos like this in the future 9:21be sure to "LIKE" and subscribe.