What Routers Do
Why do we even need network routers? A router connects different networks. Without routing every network space is isolated,
all sad and alone with no one to talk to but the same boring old nodes. Suppose you have a 192.168.1.0/24 and a 192.168.2.0/24 network.
Your two networks cannot talk to each other without a router connecting them.
These are Class C private networks with 254 usable addresses each. Use ipcalc to get nice visual information about them:
$ ipcalc 192.168.1.0/24
Address: 192.168.1.0 11000000.10101000.00000001. 00000000
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
Network: 192.168.1.0/24 11000000.10101000.00000001. 00000000
HostMin: 192.168.1.1 11000000.10101000.00000001. 00000001
HostMax: 192.168.1.254 11000000.10101000.00000001. 11111110
Broadcast: 192.168.1.255 11000000.10101000.00000001. 11111111
Hosts/Net: 254 Class C, Private Internet
Ipcalc is a Linux command line tool that takes an IP address and netmask and calculates the resulting broadcast, network,
Cisco wildcard mask, and host range.
I like that ipcalc's binary output makes a visual representation of how the netmask works. The first three octets are the network address,
and the fourth octet is the host address, so when you are assigning host addresses you "mask" out the network portion and use the leftover.
Your two networks have different network addresses, and that is why they cannot communicate without a router in between them.
Each octet is 256 bytes, but that does not give you 256 host addresses because the first and last values, 0 and 255, are reserved.
0 is the network identifier, and 255 is the broadcast address, so that leaves 254 host addresses. ipcalc helpfully spells all of this out.
This does not mean that you never have a host address that ends in 0 or 255. Suppose you have a 16-bit prefix:
$ ipcalc 192.168.0.0/16
Address: 192.168.0.0 11000000.10101000. 00000000.00000000
Netmask: 255.255.0.0 = 16 11111111.11111111. 00000000.00000000
Wildcard: 0.0.255.255 00000000.00000000. 11111111.11111111
Network: 192.168.0.0/16 11000000.10101000. 00000000.00000000
HostMin: 192.168.0.1 11000000.10101000. 00000000.00000001
HostMax: 192.168.255.254 11000000.10101000. 11111111.11111110
Broadcast: 192.168.255.255 11000000.10101000. 11111111.11111111
Hosts/Net: 65534 Class C, Private Internet
ipcalc lists your first and last host addresses, 192.168.0.1 and 192.168.255.254. You may have host addresses that end in 0 and 255,
for example 192.168.1.0 and 192.168.0.255, because those fall in between the HostMin and HostMax.
The same principles apply regardless of your address blocks, whether they are private or public,
and don't be shy about using ipcalc to help you understand.
Excerpt from "Linux LAN Routing for Beginners: Part 1" by Carla Schroder February 22, 2018 posted on linux.com
More Networking Basics:
• Workgroups and Domains
• Cisco-Linksys Network Magic Pro
• CompTIA Network+ Video Mentor
• Best CompTIA Network+ Certification Exam Preparation Materials
• Fiber Optic Cabling For Beginners
• Cloud Delivery Models
• Servers - Racks, Blades and Towers
• Web Server
• Fiber Broadband Internet Service
• What is DNS?