The network layer (Layer 3) handles logical addressing and routing. IPv4 addresses are 32βbit numbers, usually written in dottedβdecimal format (e.g., 192.168.1.10). The address is split into four 8βbit groups (octets), so each group can range from 00000000 to 11111111 in binary, which corresponds to 0 to 255 in decimal. This is why every octet must be between 0 and 255 β an address like 384.785.854.412 is invalid because those numbers exceed 255 and cannot be represented in 8 bits.
An IPv4 address consists of a network part and a host part. The division is defined by the subnet mask (e.g., /24 or 255.255.255.0).
Example: 192.168.1.34 with mask 255.255.255.0
Network = 192.168.1.0, Host = 0.0.0.34
Binary representation helps understand the split:
192.168.1.34 β 11000000.10101000.00000001.00100010
Mask 255.255.255.0 β 11111111.11111111.11111111.00000000
Network bits (first 24) = 11000000.10101000.00000001
Host bits (last 8) = 00100010
Each octet is 8 bits. To convert, remember the value of each bit position (from most significant to least):
| Bit position | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Convert binary 10101100 to decimal.
1 0 1 0 1 1 0 0
128 64 32 16 8 4 2 1
β β β β β β β β
128+0 +32 +0 +8 +4 +0 +0 = 172
Result: 10101100β = 172ββ
Convert decimal 86 to binary. Start with the largest bit value (128) and work downwards:
86
Can 128 be subtracted? No β bit 7 = 0
Can 64 be subtracted? Yes β bit 6 = 1, remainder = 86 - 64 = 22
Can 32 be subtracted from 22? No β bit 5 = 0
Can 16 be subtracted from 22? Yes β bit 4 = 1, remainder = 22 - 16 = 6
Can 8 be subtracted from 6? No β bit 3 = 0
Can 4 be subtracted from 6? Yes β bit 2 = 1, remainder = 6 - 4 = 2
Can 2 be subtracted from 2? Yes β bit 1 = 1, remainder = 2 - 2 = 0
Can 1 be subtracted from 0? No β bit 0 = 0
Reading the bits from position 7 down to 0 gives: 01010110 (often written without the leading zero as 1010110, but for 8 bits we keep the full byte).
Result: 86ββ = 01010110β
In Microsoft Excel or LibreOffice Calc, you can use builtβin functions for quick conversion:
=DEC2BIN(86; 8) returns 01010110 (to show the leading zero, we place that "8" positions in the formula).=BIN2DEC("1010110") returns 86.These functions are especially handy when you need to convert many addresses or verify your manual calculations.
Some addresses have special meanings and should not be used as normal host addresses:
127.0.0.1 is the standard loopback β it points to the local machine. Packets sent to this address never leave the device.NAT allows multiple devices on a private network to share a single public IP address. It modifies IP addresses in packets crossing the router.
How it works: The router keeps a translation table mapping (private IP:port) to (public IP:port). When a response comes back, it forwards it to the correct internal device.
These addresses are reserved for use inside private networks and are not routable on the public internet. They are the foundation of NAT.
| Network | CIDR | Address Range |
|---|---|---|
| 10.0.0.0 β 10.255.255.255 | 10.0.0.0/8 | 16,777,216 addresses |
| 172.16.0.0 β 172.31.255.255 | 172.16.0.0/12 | 1,048,576 addresses |
| 192.168.0.0 β 192.168.255.255 | 192.168.0.0/16 | 65,536 addresses |
If a device on the internet wants to reach a specific server inside your private network (e.g., a PACS server or a remote monitoring station), it must connect to your public IP address. The router then needs a rule β called port forwarding β that tells it: βwhen a packet arrives on this public port, forward it to this private IP and port.β Without port forwarding, the router does not know which internal device should receive the incoming traffic.
IP addresses can be assigned in two ways:
Because public IPv4 addresses are scarce, Internet Service Providers often use CGβNAT (also called NAT444). They assign you a private IP from the range 100.64.0.0/10 (100.64.0.0 β 100.127.255.255) and then translate that to a public IP at their own router. This means multiple customers share one public IP. For medical devices that need to be reachable from the outside (e.g., remote patient monitoring), CGβNAT can be problematic β you may need a public IP or a VPN.