Really Understand Binary by Rex A. Barzee
Author:Rex A. Barzee [Barzee, Rex A.]
Language: eng
Format: azw3
Tags: COMPUTERS / Programming / General, MATHEMATICS / Number Systems
ISBN: 9780983384083
Publisher: Maia LLC
Published: 2014-10-09T16:00:00+00:00
Network Mask
A router is a computer networking device that routes (sends to another router) packets of data from a source host in its network to the router in the destination host’s network. An internet protocol (IP) network address, which is simply a large number, has two parts: a network prefix and a host number. The network prefix occupies the most significant bits of the address, and is the same for all hosts on the same network. Because a router receives all packets sent from hosts in its network but routes only those packets whose destination network is different from its network, a router must have a fast method to determine if a packet is destined for a host on its network or another network. To determine this, a router uses its own network prefix and the bitwise and operator.
Internet protocol version 4 (IPv4) addresses are written in dot-decimal notation which is a group of four bytes in decimal separated by periods. For example, 192.168.54.15 is an IPv4 address which can be converted to hexadecimal (c0a8030f) and binary (1100 0000 1010 1000 0000 0011 0000 1111).
The network prefix of a network is written as the first address of the network followed by a slash character (/) and the number of bits in the prefix. For example, 192.168.48.0/20 is the network prefix for the network starting at 192.168.48.0 and having a 20 bit network prefix. The corresponding network prefix mask is a 32‑bit number with the 20 most significant bits set to 1 and the remaining 12 bits cleared to 0: (1111 1111 1111 1111 1111 0000 0000 0000). From this mask it is easy to see how many unique addresses are in this network. The network mask has 12 zeros, so there are 212 = 4,096 unique addresses in this network. However, some of the addresses are reserved and cannot be assigned to a host.
When a router receives a packet, it quickly determines if it needs to route the packet or not by extracting the network prefix from the source address and then extracting the network prefix from the destination address and comparing the two network prefixes. If the two network prefixes are different, the router will route the packet. If the two prefixes are the same, the router will ignore the packet because it does not need to be routed to a different network. Extracting and comparing the network prefixes can be done with the code in the next example.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12575)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8301)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7697)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7089)
Microservices with Go by Alexander Shuiskov(6858)
Practical Design Patterns for Java Developers by Miroslav Wengner(6777)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6714)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6125)
The Art of Crafting User Stories by The Art of Crafting User Stories(5650)
NetSuite for Consultants - Second Edition by Peter Ries(5584)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5392)
Kotlin in Action by Dmitry Jemerov(5066)
