IP Addresses
This week I learned more about what the numbers in IP addresses mean. In IPv4 addressing, each part of an IP address is an 8-bit number. The leftmost numbers determine what network class the IP address belongs to. Class A networks only use the leftmost 8 bits for network addressing. These numbers range from 0-127. The remaining 24 bits are used for host addressing, with each of the 127* class A networks supporting up to 16,777,214 hosts (source). Class B networks use 16 bits for network addressing and 16 bits for host addressing, with the first byte in the range 128-191, and Class C networks use 24 bits for network addressing and 8 for host addressing, with the first byte in the range 192-223.
Subnet Masks
IP addresses are split into their network and host components using subnet masks. To understand how subnet masks work, the IP address must be converted to binary format. The network portion of an IP address (the leftmost bits) are identified by 1's in the subnet mask. Class A networks would require a subnet mask of 255.0.0.0, or 11111111000000000000000000000000, whereas Class C networks need a subnet mask of 255.255.255.0, or 11111111111111111111111100000000. Performing a bitwise AND operation using the IP address and the subnet mask reveals the network portion of the address. Network administrators can create sub-networks in their organizations by adjusting the subnet mask. This is done by "borrowing" bits from the host portion of the organization's assigned IP address and using them for internal network addressing instead. Every new host on a network is provided with its subnet mask via a DHCP server, which also provides it with its IP address, the address of its first-hop router (the default gateway), and the address of the local DNS server.
Network Address Translation (NAT)
Since IPv4 is 32-bit, there are only approximately 4.2 billion possible IPv4 addresses*. Network Address Translation artificially increases the maximum number of addressable hosts. It allows private networks of hosts, each with a unique private IP address that is visible only to the local network, to share a single public IP address. Incoming internet traffic has its destination IP and destination ports changed so it can be internally routed to the correct host. This is done through the use of a forwarding table, which maps private IP/port combinations to public IP/port combinations. A basic example of this occurs if you host a Call of Duty (Cold War) LAN party. Cold War wants to use port 3074 by default. However, the home router cannot assign 3074 to each console. The first console to connect to the network (Console A) will be assigned 3074, but the second (Console B) will be assigned another available port (1024 for example). Therefore, incoming Cold War traffic to the router's (public) port 3074 will be forwarded to Console A's (private) port 3074, and incoming Cold War traffic to (public) port 1024 will be forwarded to Console B's (private) port 3074.***
* Address 127 is the "loopback" address, causing the connection to return to the initiating host. A common address used for testing network applications is called localhost, or 127.0.0.1. Connecting to this IP address means you have connected to yourself.
** IPv6, the successor to IPv4, uses 128 bits for addressing and can therefore support more unique IP addresses than grains of sand on earth. We should not run out of addresses. Hopefully.
*** Achieving Open NAT for several consoles simultaneously can be challenging, but rewarding.
** IPv6, the successor to IPv4, uses 128 bits for addressing and can therefore support more unique IP addresses than grains of sand on earth. We should not run out of addresses. Hopefully.
*** Achieving Open NAT for several consoles simultaneously can be challenging, but rewarding.
No comments:
Post a Comment