Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Digital Literacy How the Web Works The World Wide Web HTTP and HTTPS

So every computer, server, and website each have their own unique IP address, correct?

Is there anything else that has IP addresses? Do emails have IP addresses?

6 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi TJ, Yes, every device (phones, computers, wireless printers, smart TVs, etc) that connects to the internet has an IP address. Emails, per say, do not; however, the device the email was sent from does and is encoded into the email.

So devices AND websites each have their own IP address, right?

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

That's correct. In a sense, you can think about websites being a virtual device.

Your computer has an IP. When you launch a browser and try to load a page, the request is sent out with your computer's IP address as the return address (where the webpage should be sent). The request goes looking for the website's address (IP). When it finds it, the website (as a virtual device) is now talking to your computer... sending it's data to compile the website you see on your browser. So, you're device needs an IP so the website knows where to send data, and the website needs an IP so your computer knows where to get the data.

If you have multiple hosts on a one server, the server will have an IP and each site on the server will have an IP. You can think of this as a really big condo complex. The main building (the server) has one address, but every unit inside (the websites) also have their own unique address...

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

It's more appropriate to say that every internet-connected device has an IP address, but it's quite routine for several websites to share an IP, or for multiple devices to share a "public" IP via NAT, so I wouldn't say that a website has its "own" IP.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

I was under the impression, though, that you can get to any website by typing in its actual IP address.

For example:

https://teamtreehouse.com (Plain English) 173.247.98.20 (IP)

But both will take you to the website. So, I guess, now I'm a little confused. If several websites are sharing an IP how does typing one IPv4 address lead to one specific site? Nathan Williams

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

When multiple web sites share an IP address, the web server (Apache and Nginx are both popular examples) matches the incoming request's "Host" header to the appropriate vhost, or "website".

e.g.

[nathwill@wyrd ~]$ getent hosts teamtreehouse.com
173.247.98.20   teamtreehouse.com
[nathwill@wyrd zones]$ getent hosts shirts4mike.com
173.247.98.20   shirts4mike.com

These share an IP address, but the server uses the Host header of the browser's request to route the request to the appropriate site.

The reason that you end up on teamtreehouse.com when you visit the IP directly, is because we have (very consciously), set teamtreehouse.com as the "default" site for the variety of sites we run, so that requests that don't match a known hostname go to teamtreehouse.com :)

Hope that helps!

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

That I didn't know... Thank you! :)

So is it the influx of devices rather than websites that is forcing the roll out of IPv6? ... as the IPs are running out.

Jason Anders
Jason Anders
Treehouse Moderator 145,860 Points

Thanks much Nathan! I really appreciate you taking the time. :)

hi Nathan how could you say that its quite routine for several websites to share an ip address , till now what we have studied along says that each website has its own ip with whose help our client gets the webpage allocated to that ip. with the help of dns so if the a number of websites share same ip so how we get the same webpage we desired to and not the other web pages since they also have the same ip as per ur precious info?? plz help me out sir!

Thanks Nathan and Jason! Very informative.

Nathan Williams
seal-mask
.a{fill-rule:evenodd;}techdegree
Nathan Williams
Python Web Development Techdegree Student 6,851 Points

most websites have one or more static IP addresses, but there's no requirement for it. keeping DNS up to date with a dynamic IP address does have implications for DNS, but DNS can be kept up to date using what's called a "dynamic dns" service (more on that here. the point being that DNS is basically a record in a database somewhere, where the key is the hostname, and the value is the address. if the IP changes, you can just update the record, either manually, or via an API if your DNS provider offers one (most of them these days do).

hi nathan u r really very informative . can plz elaborate the above concept of static and dynamic dns u r talking about,its a request to you!!

Stephen Emery
Stephen Emery
14,384 Points

A quick note on computers and ip addresses. When a computer is connected to a wifi router, your computer will have a local ip address assigned to it that only your router knows. Your router will have it's own ip address as well on the local network. Then there's an external ip assigned to the Modem connecting you to your ISP (Internet Service Provider). Lastly, there's an ip address or a set of ip addresses your ISP uses. For a lot of personal level customers, the external ip address your box is dynamic and not static*.

It looks something like this: Your computer (192.168.1.4) -> Router (192.168.1.1) -> Modem external ip (206.55.92.10 [made up]) -> ISP public ip (79.119.190.47 [made up])

The IP address the dns sees when you make a request is the ISP's. It's up to your ISP to translate the information back down to you after they get the info. Thankfully this all happens rather fast so you don't notice it.

*Note for gamers: Personal level ISP IP addresses are dynamic making it hard to create network games for multiplayer. It's far easier to use a rpogram like Steam to handle the multiplayer connection, because with dynamic IPs it's impossible for computer to find each other.

So, does every website has a static IP Address or Dynamic IP Address? If Website Ip address changes time by time how does DNS knows? I am bit confuse