Tuesday, December 1, 2015

Week 13: Day 035 - TCP/IP Basics #6


Hello everybody, today is the day when I finally end this chapter! This entry will mainly focus on using IP Addresses. One thing to note is that next chapter will cover a lot important stuff about routing. Let's dive right in.

Funny enough for me, I already know a lot of the stuff that's about to be covered. This is static addressing vs. DHCP which is although is obvious to me now, perhaps I may forget! Basically to make the network function, each computer must have an IP address, subnet mask, and a default gateway. First I must decide what network ID I want to use. Back then, you were given a bloc of IPs, so I'll just pretend that I was given a Class C license of 197.156.4/24 in this scenario. The main rule of network addressing is that I can do whatever the heck I wanna do with my network ID. The only other rules are fairly obvious, every computer has to get a legit IP and subnet mask for my network ID. Also another thing, every IP on the network must be unique. I don't have to go in numerical order when distributing the IPs, but a lot of people do cause it's easier to identify the computers. Most networks follow these principles:

1. Give default gateway the first IP address of network ID.
2. Try to put them in numerical/sequencial order.
3. Attempt to seperate servers from clients.
4. Write down what you've decided, so your successor will understand.

Although those standards are unofficial, it's convenient, and much appreciated to whoever succeeds you as network admin. At this point you can give each and every device on the network an IP address, subnet mask, and default gateway.
Usually you'll find on the operating system you're using, the static IP information. On Windows, which I'm a million times more familiar with, there is the Internet Protocol Version 4 (TCP/IPv4) Properties dialog. Next on Mac OSX there is the Network utility in System Preferences. Then on Unix/Linux systems there is the command-line ifconfig commands. Thankfully most distros provide a GUI, which I prefer, and it's usually called Network Configuration. When you've added the IP info, you should verify using the ping command. This is the basis of Static addressing, and it's still used a lot. However there is something much simpler which is more widely used, as the average user is not as well versed as a network administrator.

This is called "Dynamic Addressing" or better known as "Dynamic Host Configuration Protocol" (DHCP), and if your old then Bootstrap Protocol (BOOTP) which is no longer used. Basically what DHCP does, is distribute IPs to the computers on the network automatically, which makes things a lot easier! When a computer is configured to use DHCP, it's called a DHCP client. When a DHCP then boots up, it sends out a DHCP Discover packet which uses the broadcast address, which was used by other functions earlier in my entries. What the message essentially say is, "Are there any DHCP servers out there?" as my textbook puts it. However, for all of this to work, one system on the LAN has to be running DHCP server software. It's designed to respond to DHCP Discover requests while also providing a response to those requests. The DHCP server hands out IP addresses from a range and subnet mask. It pass out other information as well, known as options which have many choices such as default gateway, DNS server, network time, etc. To me, the most popular DHCP server I know of, is by far Windows Server 2008.

The acceptance from the DHCP client of the DHCP server's data is a DHCP lease. The DHCP lease is set for a certain amount of time, ranging from five to eight days. It renews it after that amount of time, unless some other device took that lease, or if the said device is no longer connected to the network. The biggest problem that can happen regarding DHCP, is if a DHCP client does not receive an IP from the DHCP server. You can figure this out through some kind of error on the OS or maybe through finding out that the IP is something weird.
That weird looking special IP is created by APIPA (Automatic Private IP Addressing). All DHCP clients are designer to generate one of those addresses automatically, if no DHCP discover message is received. However APIPA can't issues a default gateway, so you can't get on the interpet using APIPA, you can only do LAN activities. When you can connect to local computers but not the internet, that gives you a big clue as to what the DHCP problem is. One way of fixing it is by reestablishing a DHCP lease, but manually. Every OS has an application which does it for you. For example, on a Mac you'd go onto System Preferences and use the Network utility to find it, which on Windows you'd type the command "ipconfig /renew". Sometimes that won't work on Windows, so you'd force it! Basically you'd type "ip config /release" followed by "ipconfig /renew" into Command Prompt. In Unix/Linux use the ifconfig command to release and renew the DHCP address. You would type "sudo ifconfig eth0 down", and then to renew "sudo ifconfig eth0 up". The reason you use sudo for that is cause you need root privileges.

Finally, the creators of TCP/IP created some special IP addresses that are important to know about. The first one is 127.0.0.1 aka the "loopback address". If you were to try to send data to that IP, you'd be sending yourself data! It's main use is to use the ping command with it, a test as to whether your NIC is capable of sending and receiving packets. A lot of people try to hide themselves from the internet by using Private IP Addresses. Routers usually destroy Private IP Addresses after they're done being used. The catch to these Private IPs is that they're useless on the internet... unless you use NAT! Before I go, take a look at these ranges of addresses designated as private IPs:
- 10.0.0.0 through 10.255.255.255 (1 Class A license)
- 172.16.0.0 through 172.31.255.255 (16 Class B licenses)
- 192.168.0.0 through 192.168.255.255 (256 Class C licenses)

One last thing, be expecting talk of NAT next chapter! On that bombshell, thanks for reading, and goodbye.


No comments:

Post a Comment