Mask Operations Masks were introduced in Chapter 3

  • Slides: 7
Download presentation
Mask Operations • Masks were introduced in Chapter 3 • IP addresses alone do

Mask Operations • Masks were introduced in Chapter 3 • IP addresses alone do not tell you the size of their network or subnet parts • Network Mask – Has 1 s in the network part – Has 0 s in the remaining bits • Subnet Mask – Has 1 s in the network plus subnet parts – Has 0 s in the remaining bits

Mask Operations • Based on Logical AND – Both must be true for the

Mask Operations • Based on Logical AND – Both must be true for the result to be true • Example – 101010 – 1111100000 – 1010100000 Data Mask Result

Mask Operations • Based on Logical AND – If mask bit is 1, get

Mask Operations • Based on Logical AND – If mask bit is 1, get back original data – If mask bit is 0, bet back zero • Example – 101010 – 1111100000 – 1010100000 Data Mask Result

Mask Operations • IP packet arrives at a router – Router sees destination IP

Mask Operations • IP packet arrives at a router – Router sees destination IP address – 1111 01000000 1010 0000 • Compares to each router forwarding table row – Address Part in First Entry – 1111 0100000000 – Mask in First Entry – 1111 11100000000

Mask Operations • Mask the IP destination Address – 1111 01000000 1010 0000 (IP

Mask Operations • Mask the IP destination Address – 1111 01000000 1010 0000 (IP address) – 1111 11100000000 (mask) – 1111 0100000000 (result) • Compare Result with First Entry Address part – 1111 0100000000 (address part) – 1111 0100000000 (result) • The Entry is a Match!

Mask Operations • Recap – Read destination IP address of incoming IP packet –

Mask Operations • Recap – Read destination IP address of incoming IP packet – For each entry in the router forwarding table • • Read the mask (prefix) Mask the incoming IP address Compare the result with the entry’s IP address part Do they match or not?

Mask Operations • Simple for Computers – Computers have circuitry to AND to numbers

Mask Operations • Simple for Computers – Computers have circuitry to AND to numbers – Computers have circuitry to COMPARE two numbers to see if they are equal or not – Very computer-friendly, so used on routers • Difficult for people, unfortunately