Home
Misc
Linux
TCP/IP
Windows
Random Daodejing
Photos

TCP/IP Notes

Intro  /  Network Addressing  /  Network Addressing IPv6  /  Packet Headers  /  Networking and Data Link Layers  /  Transport Layer Protocols  /  Application Layer Protocols  /  IP Routing  /  ICMP  /  DHCP  /  Name Resolution and DNS  /  Security 



NETWORK ADDRESSING


Network addresses are binary patterns of data based on numeric addresses (http://216.58.210.46/) which can then be translated to symbolic names (in this example "google.com") via name resolution and DNS (Domain Name System).
 
Each set of 4 numbers in an IP address must be less than 256 to be represented in 8 bits (0-255).
 
These addresses function at the Network Layer of the OSI model (Internet Layer of TCP/IP model).
 
IP addresses are arranged into classes:
 
Class A      n h.h.h
Class B      n.n h.h
Class C      n.n.n h
 
where n is the network portion, and h is the host portion. This is how multiple hosts can reside and be identified on the same network.
 
Class D addresses are reserved for multicast sessions, meaning a single address may correspond with more than one network
simultaneously, e.g. video teleconferencing.
 
Class E is reserved for experimental usage.

In class A addresses, as a rule the leading digit expressed in binary terms (high-order bit) is always 0 (00000000 - 01111111, or 1-126). By convention, 127.n.n.n is reserved for loopback (localhost). Since the remaining 3 octets are reserved for hosts, there are 24 bits of address space (3 * 8) within each Class A network, leaving 16,777,214 maximum hosts per network (subtracting 2 after exponential notation raised to the power of two for 0 and 1).
 
Class B networks use "10" for the high-order bit, leaving 14 bits of address space (or 16,382 addresses). In Class B, 172.16.0.0 - 172.31.255.255 are reserved, leaving 16,366 available public IP addresses and 65,534 maximum hosts per network.
 
Class C uses "110" as the high-order bit, leaving 21 bits of address space for the network portion, or 2,097,150 network addresses. In Class C, 192.168.0.0 - 192.168.255.255 are reserved, leaving 2,096,894 public IP addresses. This leaves 8 bits of address space dedicated to host (or 254 hosts per network).
 
Class D uses "1110" as the high-order bit.

Class E uses "11110" as the high-order bit.
 
Just as specific hosts on a network can be identified by unique addresses, the network itself can have an address (e.g., 10.0.0.0) as well as a special broadcast address (10.255.255.255) which all hosts on that network must read. In most cases this represents an 'intranet.'
 
Two destination address fields make up IP broadcast packets: the Data Link Layer destination and the destination network address field.
 
Broadcast and multicast address structures can be represented hexidecimally. A mathematical formula (last 3 octets) and lookup
table (first octet) is used by ICANN for assigning new addresses based on converting MAC to IP. To deal with vanishing address space (less than 15 percent left available in Class C as of roughly 2008), Classless Inter-Domain Routing (CIDR) was developed, which allows existing addresses to be combined into larger routing domains. Using Network Address Translation (NAT), private IP addresses can be 'mapped' to public IPs. The goal of IPv6 is to increase address space from 32
bits to 128 bits.
 
Binary           Decimal
 
10000000       128
11000000       192
11100000       224
11110000       240
11111000       248
11111100       252
11111110       254
11111111       255
 
 
00000001      1
00000011      3
00000111      7
00001111      15
00011111      31
00111111      63
01111111      127
11111111      255
 
In this case the use of exponents (2 raised to the power of bits showing - 1) can be used.
 
Network interfaces using TCP/IP have subnet masks which replace the network portion of an address with all "one" patterns (11111111 = 255):
 
Class A      n h.h.h      255.0.0.0
Class B      n.n h.h      255.255.0.0
Class C      n.n.n h      255.255.255.0
 
This can refer to a 'local neighborhood' on a network from a routing perspective. In this way a single network IP address can be divided into multiple subnetworks; machines on the same physical LAN connection can communicate via MAC, and can be passed
through an IP gateway (router) to reach another subnet. It is the routers (containing routing tables) which determine the shortest and fastest path for each packet to travel. Supernetting is then the opposite of subnetting; instead of borrowing host bits, it borrows from the network portion.
 
Two methods for designing a subnet scheme include constant-length subnet masking (CLSM) for equal number of hosts per subnet and variable-length subnet masking (VLSM) in cases where subnets don't all need to be the same size.
 
In order for private IP addresses to be able to connect to the public internet, address masquerading can be used at the firewall or proxy level.

Further Reading
---------------------

host - DNS lookup utility
https://linux.die.net/man/1/host

ping (networking utility)
https://en.wikipedia.org/wiki/Ping_(networking_utility)

WHOIS
https://en.wikipedia.org/wiki/WHOIS

127.0.0.1 IP Address Explained
https://www.lifewire.com/network-computer-special-ip-address-818385

IP Addressing
https://www.cs.virginia.edu/~cs458/slides/module03-ipaddrV3.pdf


Hexadecimal
https://en.wikipedia.org/wiki/Hexadecimal

Dot-decimal Notation
https://en.wikipedia.org/wiki/Dot-decimal_notation

Tech Stuff - Hexadecimal, Decimal and Binary
http://www.zytrax.com/tech/protocols/hex.html

Internet Protocol Tutorial: Subnets
https://www.lifewire.com/internet-protocol-tutorial-subnets-818378

Subnetting, netmasks and slash notation
http://www.sput.nl/internet/cidr-routing.html

Network and IP address calculator
http://www.tuxgraphics.org/toolbox/network_address_calculator_add.html