cnet54a-E1-6-IPv4Addresses.ppt - Krypton

Document Sample
cnet54a-E1-6-IPv4Addresses.ppt - Krypton Powered By Docstoc
					Chapter 6
IPv4 Addresses

        CNET 54A Networking Fundamentals
        Mike Murphy
        mike@foothill.edu

        Winter 2012
Note

 This presentation is not in the order of the book or online curriculum.
 This presentation also contains information beyond the curriculum.




                                                                            2
Number Systems
Network Math




               www.thinkgeek.com
                                   4
 Base 10 (Decimal) Number System
Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Number of:
          104     103     102     101   100
    10,000’s 1,000’s    100’s   10’s    1’s

1,309              1       3       0    9
   99                              9    9
  100                      1       0    0




                                              5
 Number System Rules
1. All digits start with 0
2. A Base-n number system has n number of digits:
     Decimal: Base-10 has 10 digits
     Binary: Base-2 has 2 digits
     Hexadecimal: Base-16 has 16 digits
3. The first column is always the number of 1’s

 Each of the following columns is n times the previous
  column (n = Base-n)
    Base 10: 10,000          1,000       100     10    1
    Base 2:            16          8        4     2    1
    Base 16: 65,536          4,096       256     16    1
                                                            6
Digits (2): 0, 1

Number of:
         27   ___   ___   ___     23 22     21 20
     128’s                      8’s 4’s   2’s 1’s
Dec.
 2                                        1    0
10                              1    0    1    0
17
70
130
255


                                                    7
Digits (2): 0, 1

Number of:
         27   26  25     24     23 22     21 20
     128’s 64’s 32’s   16’s   8’s 4’s   2’s 1’s
Dec.
 2                                      1    0
10                            1    0    1    0
17                      1     0    0    0    1
70           1    0     0     0    1    1    0
130     1    0    0     0     0    0    1    0
255     1    1    1     1     1    1    1    1


                                                  8
Digits (2): 0, 1

Number of:
         27   26  25     24     23 22     21 20
     128’s 64’s 32’s   16’s   8’s 4’s   2’s 1’s
Dec.
              1    0    0     0    1    1    0
                   1    0     1    0    0    0
         0    0    0    0     0    0    0    0
         1    0    0    0     0    0    0    0
172
192


                                                  9
Digits (2): 0, 1

Number of:
         27   26  25     24     23 22     21 20
     128’s 64’s 32’s   16’s   8’s 4’s   2’s 1’s
Dec.
70            1    0    0     0    1    1    0
40                 1    0     1    0    0    0
0        0    0    0    0     0    0    0    0
128      1    0    0    0     0    0    0    0
172      1    0    1    0     1    1    0    0
192      1    1    0    0     0    0    0    0


                                                 10
Program for number conversion




                                11
Program for number conversion




                                12
Program for number conversion




                                13
Binary
to/from
Decimal




 Chapter 6 (Book and Curriculum) provides several methods and examples
  for doing the conversion between binary and decimal.



                                                                          14
IPv4 Addresses
IPv4 Addresses




 IPv4 addresses are 32 bit addresses




                                        16
 IPv4 Addresses
 IPv4 Addresses are 32 bit addresses:

        1010100111000111010001011000100

        10101001      11000111      01000101      10001001

 We use dotted notation (or dotted decimal notation) to
  represent the value of each byte (octet) of the IP address in
  decimal.

        10101001 11000111 01000101 10001001
            169 . 199    .  69    . 137




                                                                  17
IPv4 Addresses
An IP address has two parts:
     network number
     host number




Which bits refer to the network number?

Which bits refer to the host number?




                                          18
 IPv4 Addresses
Answer:
 Newer technology - Classless IP Addressing
    The subnet mask determines the network portion and the host
     portion.
    Value of first octet does NOT matter (older classful IP addressing)
    Hosts and Classless Inter-Domain Routing (CIDR).
    Classless IP Addressing is what is used within the Internet and in
     most internal networks.

 Older technology - Classful IP Addressing (later)
    Value of first octet determines the network portion and the host
     portion.
    Used with classful routing protocols like RIPv1.
    The Cisco IP Routing Table is structured in a classful manner (CIS
     82)

                                                                           19
Types of
Addresses


Network
Addresses have
all 0’s in the host
portion.

                Subnet Mask: 255.255.255.0




 Network address - The address by which we refer to the network
 Broadcast address - A special address used to send data to all
  hosts in the network
 Host addresses - The addresses assigned to the end devices in the
  network                                                             20
Types of
Addresses


Broadcast
Addresses have
all 1’s in the host
portion.

                Subnet Mask: 255.255.255.0




 Network address - The address by which we refer to the network
 Broadcast address - A special address used to send data to all
  hosts in the network
 Host addresses - The addresses assigned to the end devices in the
  network                                                             21
Types of
Addresses


Host Addresses
can not have all
0’s or all 1’s in the
host portion.

                 Subnet Mask: 255.255.255.0




 Network address - The address by which we refer to the network
 Broadcast address - A special address used to send data to all
  hosts in the network
 Host addresses - The addresses assigned to the end devices in the
  network                                                             22
Dividing the Network and Host Portions



     11111111111111110000000000000000


 Subnet Mask
    Used to define the:
       Network portion
       Host portion
    32 bits
    Contiguous set of 1’s followed by a contiguous set of 0’s
       1’s: Network portion
       0’s: Host portion


                                                                 23
Dividing the Network and Host Portions



                   11111111.11111111.00000000.00000000

Dotted decimal:       255     .    255   .   0   .   0
Slash notation: /16

 Expressed as:
    Dotted decimal
       Ex: 255.255.0.0
    Slash notation or prefix length
       /16 (the number of one bits)



                                                         24
Network
Addresses




             Subnet Mask: 255.255.255.0




 Network address - The address by which we refer to the network
    All binary 0’s in the host portion of the address (more later)


                                                                      25
Example 1
Network Address:   192.168.1.0
Subnet Mask:       255.255.255.0

                   192.168.1.0
                   Network Host

Network Address in binary:
                    network        host
        11000000.10101000.00000001.00000000
Subnet Mask in binary:
        11111111.11111111.11111111.00000000
Prefix Length:   /24
                                              26
Example 2
Network Address:   172.0.0.0
Subnet Mask:       255.0.0.0

                    172.0.0.0
                  Network Host

Network Address in binary:
        network        host
        10101100.00000000.00000000.00000000
Subnet Mask in binary:
        11111111.00000000.00000000.00000000
Prefix Length :   /8

                                              27
Example 3
Network Address:      172.0.0.0
Subnet Mask:          255.255.0.0

                   172.0.0.0
                 Network Host

Network Address in binary:
            network             host
        10101100.00000000.00000000.00000000
  Subnet Mask in binary:
        11111111.11111111.00000000.00000000
Prefix Length:   /16

                                              28
Subnet Masks – Your Turn!
Underline the network portion of each address:
Network Address   Subnet Mask
172.0.0.0         255.0.0.0
172.16.0.0        255.255.0.0
192.168.1.0       255.255.255.0
192.168.0.0       255.255.0.0
192.168.0.0       255.255.255.0
10.1.1.0          /24
10.2.0.0          /16
10.0.0.0          /16

 What is the other portion of the address?



                                                 29
Subnet Masks – Your Turn!
Underline the network portion of each address:
Network Address   Subnet Mask
172.0.0.0         255.0.0.0
172.16.0.0        255.255.0.0
192.168.1.0       255.255.255.0
192.168.0.0       255.255.0.0
192.168.0.0       255.255.255.0
10.1.1.0          /24
10.2.0.0          /16
10.0.0.0          /16

 What is the other portion of the address?
    Host portion for host addresses


                                                 30
 Why the mask matters: Number of hosts!


Subnet Mask:            1st octet   2nd octet   3rd octet    4th octet
255.0.0.0 or /8        Network        Host        Host        Host
255.255.0.0 or /16     Network Network            Host        Host
255.255.255.0 or /24   Network Network Network                Host

  The more host bits in the subnet mask means the more hosts in the
   network.
  Subnet masks do not have to end on “natural octet boundaries”




                                                                         31
 Subnet: 255.0.0.0 (/8)

          Network        Host         Host        Host

                         8 bits      8 bits       8 bits
                             With 24 bits available for hosts,
                             there a 224 possible addresses.
                             That’s 16,777,216 nodes!

 Only large organizations such as the military, government agencies,
  universities, and large corporations have networks with these many
  addresses.
 Example: A certain cable modem ISP has 24.0.0.0 and a DSL ISP
  has 63.0.0.0

                                                                        32
Subnet: 255.255.0.0 (/16)

       Network Network           Host         Host

                                 8 bits      8 bits
                         With 16 bits available for hosts,
                         there a 216 possible addresses.
                         That’s 65,536 nodes!


 65,534 host addresses, one for network address and one for
  broadcast address.




                                                               33
Subnet: 255.255.255.0 (/24)

     Network Network Network                Host

                                            8 bits
                        With 8 bits available for hosts,
                        there a 28 possible addresses.
                        That’s 256 nodes!

 254 host addresses, one for network address and one for
  broadcast address.




                                                            34
 IP Addresses




There is a tradeoff between:
 The number of network bits and the number of networks (subnets) you
  can have…
AND
 The number of HOST bits and the number of hosts for each network
  you can have.

This will be examined more closely, later.



                                                                        35
Broadcast
Addresses




 Broadcast address - A special address used to send data to all
  hosts in the network
    All binary 1’s in the host portion of the address (more later)

                                                                      36
Subnet Masks – Your Turn!
What is the broadcast address of each network:
Network Address   Subnet Mask       Broadcast Address
172.0.0.0         255.0.0.0
172.16.0.0        255.255.0.0
192.168.1.0       255.255.255.0
192.168.0.0       255.255.0.0
192.168.0.0       255.255.255.0
10.1.1.0          /24
10.2.0.0          /16
10.0.0.0          /16




                                                        37
Subnet Masks – Your Turn!
What is the broadcast address of each network:
Network Address   Subnet Mask       Broadcast Address
172.0.0.0         255.0.0.0         172.255.255.255
172.16.0.0        255.255.0.0       172.16.255.255
192.168.1.0       255.255.255.0     192.168.1.255
192.168.0.0       255.255.0.0       192.168.255.255
192.168.0.0       255.255.255.0     192.168.0.255
10.1.1.0          /24               10.1.1.255
10.2.0.0          /16               10.2.255.255
10.0.0.0          /16               10.0.255.255




                                                        38
Bringing it
all together




 Subnet Mask divides Network portion and Host portion:
    1’s: Network portion
    0’s: Host portion
 Network address:
    All 0’s in the host portion of the address
 Broadcast address:
    All 1’s in the host portion of the address
                                                          39
  Bringing it all together

 Convert these addresses and masks to Binary (to be used
  later)

Network: 172.0.0.0   10101100.00000000.00000000.00000000
Mask:    255.0.0.0   11111111.00000000.00000000.00000000
   172.255.255.255   10101100.11111111.11111111.11111111
Broadcast Address

Network: 172.16.0.0 10101100.00010000.00000000.00000000
Mask:   255.255.0.0 11111111.11111111.00000000.00000000
172.16.255.255      10101100.00010000.11111111.11111111
Broadcast Address


                                                            40
  Bringing it all together
 Convert these addresses and masks to Binary (to be used
  later)

Network: 192.168.1.0   11000000.10101000.00000001.00000000
Mask: 255.255.255.0    11111111.11111111.11111111.00000000
Bcst: 192.168.1.255    11000000.10101000.00000001.11111111

Network: 192.168.0.0 11000000.10101000.00000000.00000000
Mask:    255.255.0.0 11111111.11111111.00000000.00000000
Bcst: 192.168.255.255 11000000.10101000.11111111.11111111

Network: 192.168.0.0   11000000.10101000.00000000.00000000
Mask: 255.255.255.0    11111111.11111111.11111111.00000000
Bcst: 192.168.0.255    11000000.10101000.00000000.11111111
                                                             41
Bringing it all together
 Convert these addresses and masks to Binary (to be
  used later)

Network: 10.1.1.0   00001010.00000001.00000001.00000000
Mask: /24           11111111.11111111.11111111.00000000
Bcast: 10.1.1.255   00001010.00000001.00000001.11111111

Network: 10.2.0.0   00001010.00000010.00000000.00000000
Mask: /16           11111111.11111111.00000000.00000000
Bst:10.2.255.255    00001010.00000010.11111111.11111111

Network 10.0.0.0    00001010.00000000.00000000.00000000
Mask: /16           11111111.11111111.00000000.00000000
Bcast10.0.255.255   00001010.00000000.11111111.11111111
                                                          42
Host IP Addresses


                                             192.168.10.100/24




 Host IP Addresses contain:
    Network portion of the address
    Unique combination of 0’s and 1’s in the host portion of the
     address
        Cannot be all 0’s (network address)
        Cannot be all 1’s (broadcast address)
 Hosts have subnet masks to determine network portion (later)
                                                                    43
Range of hosts – Your Turn!
 Host addresses are all addresses between the network
  address and the broadcast address.
 What is the range of host addresses for each network?
Network Address   Subnet Mask       Broadcast Address
172.0.0.0         255.0.0.0         172.255.255.255
172.16.0.0        255.255.0.0       172.16.255.255
192.168.1.0       255.255.255.0     192.168.1.255
192.168.0.0       255.255.0.0       192.168.255.255
192.168.0.0       255.255.255.0     192.168.0.255
10.1.1.0          /24               10.1.1.255
10.2.0.0          /16               10.2.255.255
10.0.0.0          /16               10.0.255.255



                                                      44
Range of hosts – Your Turn!
Network Address   Subnet Mask       Broadcast Address
172.0.0.0         255.0.0.0         172.255.255.255
172.0.0.1 through 172.255.255.254

172.16.0.0        255.255.0.0       172.16.255.255
172.16.0.1 through 172.16.255.254

192.168.1.0       255.255.255.0     192.168.1.255
192.168.1.1 through 192.168.1.254

192.168.0.0       255.255.0.0       192.168.255.255
192.168.0.1 through 192.168.255.254

192.168.0.0       255.255.255.0     192.168.0.255
192.168.0.1 through 192.168.0.254
                                                        45
Range of hosts – Your Turn!
Network Address   Subnet Mask   Broadcast Address

10.1.1.0          /24           10.1.1.255
10.1.1.1 through 10.1.1.254

10.2.0.0          /16           10.2.255.255
10.2.0.1 through 10.2.255.254

10.0.0.0          /16           10.0.255.255
10.0.0.1 through 10.0.255.254




                                                    46
Range of hosts – Your Turn!
 Host Addresses in binary

172.0.0.0 (net)    10101100.00000000.00000000.00000000
255.0.0.0 (SM)     11111111.00000000.00000000.00000000
172.0.0.1          10101100.00000000.00000000.00000001
172.255.255.254    10101100.11111111.11111111.11111110
172.255.255.255    10101100.11111111.11111111.11111111
(broadcast)

172.16.0.0 (net)   10101100.00010000.00000000.00000000
255.255.0.0 (SM)   11111111.11111111.00000000.00000000
172.16.0.1         10101100.00010000.00000000.00000001
172.16.255.254     10101100.00010000.11111111.11111110
172.16.255.255     10101100.00010000.11111111.11111111
(broadcast)                                              47
Range of hosts – Your Turn!
 Host Addresses in binary

192.168.1.0 (net)   11000000.10101000.00000001.00000000
255.255.255.0(SM)   11111111.11111111.11111111.00000000
192.168.1.1         11000000.10101000.00000001.00000001
192.168.1.254       11000000.10101000.00000001.11111110
192.168.1.255       11000000.10101000.00000001.11111111
(broadcast)

192.168.0.0 (net)   11000000.10101000.00000000.00000000
255.255.0.0 (SM)    11111111.11111111.00000000.00000000
192.168.0.1         11000000.10101000.00000000.00000001
192.168.255.254     11000000.10101000.11111111.11111110
192.168.255.255     11000000.10101000.11111111.11111111
(broadcast)                                               48
Range of hosts – Your Turn!
 Host Addresses in binary

192.168.0.0 (net)   11000000.10101000.00000000.00000000
255.255.255.0(SM)   11111111.11111111.11111111.00000000
192.168.0.1         11000000.10101000.00000000.00000001
192.168.0.254       11000000.10101000.00000000.11111110
192.168.0.255       11000000.10101000.00000000.11111111
(broadcast)




                                                          49
Range of hosts – The rest…
Host Addresses in binary

10.1.1.0 (net)    00001010.00000001.00000001.00000000
/24   (SM)        11111111.11111111.11111111.00000000
10.1.1.1          00001010.00000001.00000001.00000001
10.1.1.254        00001010.00000001.00000001.11111110
10.1.1.255        00001010.00000001.00000001.11111111
(broadcast)

10.2.0.0 (net)    00001010.00000010.00000000.00000000
/16    (SM)       11111111.11111111.00000000.00000000
10.2.0.1          00001010.00000010.00000000.00000001
10.2.255.254      00001010.00000010.11111111.11111110
10.2.255.255      00001010.00000010.11111111.11111111
(broadcast)                                             50
Range of hosts – The rest…
• Host Addresses in binary



10.0.0.0 (net)   00001010.00000000.00000000.00000000
/16    (SM)      11111111.11111111.00000000.00000000
10.0.0.1         00001010.00000000.00000000.00000001
10.0.255.254     00001010.00000000.11111111.11111110
10.0.255.255     00001010.00000000.11111111.11111111
(broadcast)




                                                       51
Subnet Masks: on Non-Octet Boundaries
 Subnet masks do not have to end on octet boundaries
 Convert these to binary:

Network Address   Subnet Mask
172.1.16.0        255.255.240.0

192.168.1.0       255.255.255.224




                                                        52
Subnet Masks: on Non-Octet Boundaries
 Subnet masks do not have to end on natural octet
  boundaries

172.1.16.0       10101100.00000001.00010000.00000000
255.255.240.0    11111111.11111111.11110000.00000000

 What is the range of host addresses in dotted-decimal
  and binary?
 What is the broadcast address?
 How many host addresses?




                                                       53
Subnet Masks: Non-Octet Boundaries
 Subnet masks do not have to end on natural octet
  boundaries
172.1.16.0        10101100.00000001.00010000.00000000
255.255.240.0     11111111.11111111.11110000.00000000

172.1.16.1        10101100.00000001.00010000.00000001
172.1.16.2        10101100.00000001.00010000.00000010
172.1.16.3        10101100.00000001.00010000.00000011
…
172.1.16.255      10101100.00000001.00010000.11111111
172.1.17.0        10101100.00000001.00010001.00000000
172.1.17.1        10101100.00000001.00010001.00000001
…
172.1.31.254      10101100.00000001.00011111.11111110
                                                        54
Subnet Masks: Non-Octet Boundaries
 Subnet masks do not have to end on natural octet
  boundaries
172.1.16.0        10101100.00000001.00010000.00000000
255.255.240.0     11111111.11111111.11110000.00000000

172.1.16.1        10101100.00000001.00010000.00000001
…
172.1.31.254      10101100.00000001.00011111.11111110

172.1.31.255      10101100.00000001.00011111.11111111
(broadcast)

Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts


                                                        55
Subnet Masks: Non-Octet Boundaries
 Subnet masks do not have to end on natural octet
  boundaries

192.168.1.0       11000000.10101000.00000001.00000000
255.255.255.224   11111111.11111111.11111111.11100000

192.168.1.1       11000000.10101000.00000001.00000001
192.168.1.2       11000000.10101000.00000001.00000010
192.168.1.3       11000000.10101000.00000001.00000011
…
192.168.1.29      11000000.10101000.00000001.00011101
192.168.1.30      11000000.10101000.00000001.00011110

192.168.1.31      11000000.10101000.00000001.00011111
(broadcast)
                                                        56
Subnet Masks: Non-Octet Boundaries
 Subnet masks do not have to end on natural octet
  boundaries

192.168.1.0       11000000.10101000.00000001.00000000
255.255.255.224   11111111.11111111.11111111.11100000

192.168.1.1       11000000.10101000.00000001.00000001
…
192.168.1.30      11000000.10101000.00000001.00011110

192.168.1.31      11000000.10101000.00000001.00011111
(broadcast)

Number of hosts: 25 – 2 = 32 – 2 = 30 hosts
                                                        57
Part 2
Host IP Addresses
Host IP Addresses
172.0.0.0 (net)    10101100.00000000.00000000.00000000
255.0.0.0 (SM)     11111111.00000000.00000000.00000000
172.0.0.1          10101100.00000000.00000000.00000001
172.255.255.254    10101100.11111111.11111111.11111110
172.255.255.255    10101100.11111111.11111111.11111111
(broadcast)

172.16.0.0 (net)   10101100.00010000.00000000.00000000
255.255.0.0 (SM)   11111111.11111111.00000000.00000000
172.16.0.1         10101100.00010000.00000000.00000001
172.16.255.254     10101100.00010000.11111111.11111110
172.16.255.255     10101100.00010000.11111111.11111111
(broadcast)

                                                         60
Host IP Addresses
172.1.16.0        10101100.00000001.00010000.00000000
255.255.240.0     11111111.11111111.11110000.00000000

172.1.16.1        10101100.00000001.00010000.00000001
…
172.1.31.254      10101100.00000001.00011111.11111110

172.1.31.255      10101100.00000001.00011111.11111111
(broadcast)

Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts




                                                        61
Who assigns IP Network Addresses?




 Internet Assigned Numbers Authority (IANA)
  (http://www.iana.net) is the master holder of the IP addresses.
 Today, the remaining IPv4 address space has been allocated to
  various other registries to manage for particular purposes or for
  regional areas.
    Regional Internet Registries (RIRs)




                                                                      62
Regional Internet Registries (RIR)




 The 5 RIR’s are:
    AfriNIC (African Network Information Centre) - Africa Region
     http://www.afrinic.net
    APNIC (Asia Pacific Network Information Centre) - Asia/Pacific Region
     http://www.apnic.net
    ARIN (American Registry for Internet Numbers) - North America Region
     http://www.arin.net
    LACNIC (Regional Latin-American and Caribbean IP Address Registry) -
     Latin America and some Caribbean Islands http://www.lacnic.net
    RIPE NCC (Reseaux IP Europeans) - Europe, the Middle East, and Central 63
     Asia http://www.ripe.net
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.




 Tier 1 ISP:
    Large national or international ISPs that are directly connected to the
      Internet backbone.
    Customers of Tier 1 ISPs:
         lower-tiered ISPs
         large companies and organizations.
    Offer reliability and speed
    AOL, SPRINT, Global Crossing, AT&T, Level 3, Verizon, NTT, Quest,
      SAVVIS                                                                   64
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.




 Tier 2 ISP:
    Acquire their Internet service from Tier 1 ISPs. Tier 2 ISPs generally
      focus on business customers.
    Examples: Allstream, AboveNet, British Telecom, Cogent
      Communications, France Telecom, Teleglobe TeliaSonera International
      Carrier Time Warner Telecom, Tiscali International Network, XO
      Communications


                                                                              65
ISP (Internet
Service Providers)
Most companies or
organizations obtain
their IPv4 address
blocks from an ISP.




 Tier 3 ISP:
    Purchase their Internet service from Tier 2 ISPs. The focus of these
      ISPs is the retail and home markets in a specific locale. Examples:
    Local ISPs




                                                                            66
Special Unicast IPv4 Addresses


 Default Route

 Loopback Address
    Special address that hosts use to direct traffic to themselves.
    127.0.0.0 to 127.255.255.255

 Link-Local Addresses
    169.254.0.0 to 169.254.255.255 (169.254.0.0 /16)
    Can be automatically assigned to the local host by the operating system
      in environments where no IP configuration is available.

 TEST-NET Addresses
    192.0.2.0 to 192.0.2.255 (192.0.2.0 /24)
    Set aside for teaching and learning purposes.
    These addresses can be used in documentation and network examples.        67
Private IP
Addresses




   RFC 1918
      10.0.0.0 to 10.255.255.255 (10.0.0.0 /8)
      172.16.0.0 to 172.31.255.255 (172.16.0.0 /12)
      192.168.0.0 to 192.168.255.255 (192.168.0.0 /16)
   The addresses will not be routed in the Internet
      Need NAT/PAT (next)
   Should be blocked by your ISP
   Allows for any network to have up to 16,777,216 hosts (/8)   68
Introducing NAT
and PAT



 NAT is designed to conserve IP addresses and enable networks to use
  private IP addresses on internal networks.
 These private, internal addresses are translated to routable, public
  addresses.
 IPv4 addresses are almost depleted.
 NAT/PAT has allowed IPv4 to be the predominant network protocol,
  keeping IPv6 at-bay (for now).




                                                                         69
    NAT Example
1                                          2




    DA         SA                                 DA           SA

128.23.2.2   10.0.0.3    ....   Data            128.23.2.2   179.9.8.80   ....   Data

             IP Header                                       IP Header
1                                           2

    The translation from Private source IP address to Public source IP address.
                                                                                        70
     NAT Example
4                                          3




    DA        SA                                   DA         SA

10.0.0.3   128.23.2.2   ....      Data         179.9.8.80   128.23.2.2   ....        Data

    4      IP Header                           3            IP Header

    Translation back, from Public destination IP address to Private destination IP
       address.                                                                             71
    PAT Example


                                                    179.9.8.80



                                              NAT/PAT table
                                              maintains translation
                                              of:
                                              DA, SA, SP
  DA           SA         DP    SP                         DA         SA        DP    SP

128.23.2.2     10.0.0.3   80    1331   Data             128.23.2.2 179.9.8.80    80   3333   Data

             IP Header     TCP/UDP                                 IP Header     TCP/UDP
1                           Header                      2                         Header


  DA           SA         DP    SP                         DA         SA        DP    SP

128.23.2.2    10.0.0.2     80   1555   Data             128.23.2.2 179.9.8.80    80   2222   Data

             IP Header     TCP/UDP                                 IP Header     TCP/UDP
                            Header                                                Header
                                                                                                    72
PAT Example


                                                  179.9.8.80




                                            NAT/PAT table maintains
                                            translation of:
                                            SA (DA), DA (SA), DP (SP)
    DA         SA        DP     SP                        DA           SA         DP     SP

 10.0.0.3   128.23.2.2   1331   80    Data              179.9.8.80 128.23.2.2     3333   80   Data

            IP Header     TCP/UDP                                    IP Header     TCP/UDP
4                          Header                       3                           Header


    DA         SA        DP     SP                        DA           SA         DP     SP

10.0.0.2    128.23.2.2   1555   80   Data               179.9.8.80   128.23.2.2   2222   80   Data

            IP Header     TCP/UDP                                    IP Header     TCP/UDP
                           Header                                                   Header
                                                                                                     73
The Subnet Mask and the AND
         Operation
Subnet Mask




      Host: “I’m a host on the 192.168.1.0/24 network.”

 The subnet mask is used to separate the network portion from the
  host portion of the address.
 On a host, the subnet mask tells the host what network it belongs to.
 Why does a host need to know what network it belongs to?



                                                                          75
Subnet Mask




     Host: “I’m a host on the 192.168.1.0/24 network.”

 Why does a host need to know what network it belongs to?
 So, it knows whether to encapsulate the IP packet into an Ethernet
  frame with:
     The Destination MAC Address of the default gateway
         Must know the default gateway’s IP address
     The Destination MAC Address of the host with the Destination IP
      address of the packet
 Later when we discuss Ethernet                                        76
  Subnet Mask
                                Network                  Host

Host IP: 172.16.33.10 10101100.00010000.00100001.00001010
Mask:    255.255.0.0 11111111.11111111.00000000.00000000
                      -----------------------------------
Net Add: 172.16.0.0   10101100.00010000.00000000.00000000




   Devices such as hosts use the bit-wise AND operation on the:
      Host IP address
      Subnet mask
   AND operation:
      1 AND 1 = 1
      0 AND anything = 0
                                                                   77
  Subnet Mask
                              Network            Host

Host IP: 172.16.33.10 10101100.00010000.00100001.00001010
Mask:   255.255.255.0 11111111.11111111.11111111.00000000
                      -----------------------------------
Net Add: 172.16.33.0 10101100.00010000.00100001.00000000




   AND operation:
      1 AND 1 = 1
      0 AND anything = 0




                                                            78
  Subnet Mask
                                    Network            Host

Host IP: 172.1.17.9         10101100.00000001.00010001.00001001
Mask: 255.255.240.0         11111111.11111111.11110000.00000000
                            -----------------------------------
Net Add: 172.1.16.0         10101100.00000001.00010000.00000000




   AND operation:
      1 AND 1 = 1
      0 AND anything = 0




                                                                  79
Subnet Masks: Non-Natural Boundaries
 Subnet masks do not have to end on natural octet
  boundaries
172.1.16.0        10101100.00000001.00010000.00000000
255.255.240.0     11111111.11111111.11110000.00000000

172.1.16.1        10101100.00000001.00010000.00000001
…
172.1.31.254      10101100.00000001.00011111.11111110

172.1.31.255      10101100.00000001.00011111.11111111
(broadcast)

Number of hosts: 212 – 2 = 4,096 – 2 = 4,094 hosts


                                                        80
Subnetting: First Look
    Subnets and Subnet Masks




     Formalized in 1985, the subnet mask breaks
     a single network in to smaller pieces.

   Allows network administrators to divide their network into small networks
    or subnets.
   Advantages will be discussed later.




                                                                            82
  What is subnetting?
              Network Network                Host          Host
                  172            16             0             0


              Network Network              Subnet          Host
 Subnetting is the process of borrowing bits from the HOST bits, in order to divide
  the larger network into small subnets.
 Subnetting does NOT give you more hosts, but actually costs you hosts.
 You lose two host IP Addresses for each subnet, one for the subnet IP address
  and one for the subnet broadcast IP address.
 You lose the last subnet and all of it’s hosts’ IP addresses as the broadcast for
  that subnet is the same as the broadcast for the network.
 In older technology, you would have lost the first subnet, as the subnet IP
  address is the same as the network IP address. (This subnet can be used in
  most networks.)

                                                                                       83
Analogy
               Before subnetting:
                In any network (or subnet) we can not use
                   all the IP addresses for host addresses.
                We lose two addresses for every network
   98 Apples       or subnet.
   (100 – 2)   1. Network Address - One address is reserved
                   to that of the network. For Example:
                   172.16.0.0 /16
               2. Broadcast Address – One address is
                   reserved to address all hosts in that
                   network or subnet. For Example:
                   172.16.255.255
               This gives us a total of 65,534 usable hosts




                                                              84
Analogy                   10 barrels x 10 apples = 100 apples


                           10             10             10

      98 Apples
      (100 – 2)            10             10             10


                           10              10            10



                                                         10

 It is the same as taking a barrel of 100 apples and
  dividing it into 10 barrels of 10 apples each.              85
2 = 1 network address + 1 broadcast address
                              10 barrels x 8 apples = 80 apples

                                  8              8              8
                                      (less 2)       (less 2)       (less 2)


        98 Apples                 8              8              8
        (100 – 2)                     (less 2)       (less 2)       (less 2)


                                  8              8              8
                                      (less 2)       (less 2)       (less 2)


 However, in subnetting we will see that we lose two
  apples per subnet:                                                           8
    one for the network address
    one for the broadcast address                                  (less 2)



                                                                                   86
2 = 1 network address + 1 broadcast address
                              8 barrels x 8 apples = 64 apples

                                  8    X
                                      (less 2)
                                                 8
                                                     (less 2)
                                                                8
                                                                    (less 2)


        98 Apples                 8              8              8
        (100 – 2)                     (less 2)       (less 2)       (less 2)


                                  8              8              8
                                      (less 2)       (less 2)       (less 2)
 In legacy networks, we also lost:
    The first basket (subnet)
         The network address of the first subnet is the
          network address of the entire network
                                                                     X         8

                                                                    (less 2)
    The last basket (subnet)
         The broadcast address for the last subnet is the
          same as for the entire network.                                          87
   Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask
Using Subnets: Subnet Mask 255.255.255.0 or /24
                             Subnet addresses: All 0’s in host portion
   Network Network         Subnet        Host

      172         16           0           0            Subnets
                                                        Addresses
      172         16           1           0
      172         16          2            0
                                                         256
      172         16          3            0             Subnets

      172         16         Etc.          0             28

      172         16         254           0
      172         16         255           0
                                                                         88
   Subnet Example
Network address 172.16.0.0 with /16 Base Network Mask
Using Subnets: Subnet Mask 255.255.255.0 or /24

Network Network          Subnet       Hosts
                                                          Broadcast
   172         16           0            1          254      255
   172         16           1            1          254      255
   172         16           2            1          254      255
   172         16           3            1          254      255
   172         16          Etc.          1          254      255
   172         16          254           1          254      255
   172         16          255           1          254      255
               Each subnet has 254 hosts, 28 – 2                   89
                         Host IP Address: 172.16.3.50
                             A host of the 172.16.3.0 /24 network
With NO subnetting:

Network        First Host      Last Host          Broadcast
172.16.0.0     172.16.0.1      172.16.255.254    172.16.255.255


 65,534 host addresses, one for network address and one for
  broadcast address.

Host IP Address: 172.16.3.50
    A host of the 172.16.0.0 /16 network




                                                                     90
                       Host IP Address: 172.16.3.50
With subnetting:           A host of the 172.16.3.0 /24 network

Network        First Host     Last Host            Broadcast
172.16.0.0     172.16.0.1     172.16.0.254         172.16.0.255
172.16.1.0     172.16.1.1     172.16.1.254         172.16.1.255
172.16.2.0     172.16.2.1     172.16.2.254         172.16.2.255
172.16.3.0     172.16.3.1     172.16.3.254         172.16.3.255
172.16.4.0     172.16.4.1     172.16.4.254         172.16.4.255
172.16.5.0     172.16.5.1     172.16.5.254         172.16.5.255
172.16.6.0     172.16.6.1     172.16.6.254         172.16.6.255
172.16.7.0     172.16.7.1     172.16.7.254         172.16.7.255
…
172.16.254.0   172.16.254.1   172.16.254.254       172.16.15.255
172.16.255.0   172.16.255.1   172.16.255.254       172.16.255.255




                                                                    91
With subnetting:
Network        First Host     Last Host        Broadcast          Hosts
172.16.0.0     172.16.0.1     172.16.0.254     172.16.0.255       254
172.16.1.0     172.16.1.1     172.16.1.254     172.16.1.255       254
172.16.2.0     172.16.2.1     172.16.2.254     172.16.2.255       254
172.16.3.0     172.16.3.1     172.16.3.254     172.16.3.255       254
172.16.4.0     172.16.4.1     172.16.4.254     172.16.4.255       254
172.16.5.0     172.16.5.1     172.16.5.254     172.16.5.255       254
172.16.6.0     172.16.6.1     172.16.6.254     172.16.6.255       254
172.16.7.0     172.16.7.1     172.16.7.254     172.16.7.255       254
…
172.16.254.0   172.16.254.1   172.16.254.254   172.16.15.255      254
172.16.255.0   172.16.255.1   172.16.255.254   172.16.255.255     254
                                                                  ---
                                                                65,024


Total address = 256 subnets * (256 hosts – 2)
              = 256 * 254
              = 65,024


                                                                     92
With subnetting:
Network        First Host     Last Host      Broadcast
172.16.0.0     172.16.0.1      172.16.0.254   172.16.0.255
172.16.255.0   172.16.255.1   172.16.255.254 172.16.255.255

Major Network Address: 172.16.0.0
Major Network Mask: 255.255.0.0
Major Network Broadcast Address: 172.16.255.255
Subnet Mask: 255.255.255.0

First Subnet:
Subnet Address: 172.16.0.0
Subnet Broadcast Address: 172.16.0.255

Last Subnet:
Subnet Address: 172.16.255.0
Subnet Broadcast Address: 172.16.255.255


                                                              93
Subnetting: Step-by-step
Determining Network and Subnet Information
 Use the Classless Subnetting Worksheet (Excel Spreadsheet) to do the
  following:
 Given any IP address and major network mask we can determine:
     Major Network Address
     First host address of the network
     Last host address of the network
     Broadcast address of the network
     Number of usable hosts in the network
 If the network is subnetted and we know the subnet mask we can
  determine:
     Subnet (network) Address
     First host address of the subnet
     Last host address of the subnet
     Broadcast address of the subnet
     Number of usable hosts in the subnet
     Number of usable subnets in this network

                                                                         95
 See these spreadsheets on my website

                              Nutshell: Classless
                              Subnetting in a Nutshell
                              (Excel spreadsheet)




Worksheet: Classless
Subnetting Worksheet (Excel
spreadsheet)

                                                         96
Part 1: Determine Major Network Information




                                              97
 Convert IP Address/Network Mask to Binary
 First, let’s determine the Major Network Information.
 This is the information for the entire network, whether or not there are subnets.
 Using the Major Network Mask, determine the major network Address, the broadcast
  address for the entire network, and the number of hosts for the entire network.
 The Major Network Mask (or Base Mask, Subnet Mask) is provided by the ISP.
 Convert these addresses to binary.
          Host IP Address:138.101.114.250
          Major Network Mask: 255.255.0.0 (/16)




                                                                                      98
    Determine Network Address
    Determine the Network Address by using the AND operation.
    Perform a bit-wise AND operation on the IP Address and the Subnet Mask
    Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
    Express the result in Dotted Decimal Notation
    The result is the Major Network Address of this for this host IP Address is
     138.101.0.0




                                                                                   99
Determine Network Address
A simple way of doing the AND operation:
1. In the Network mask locate where the 1’s end and the 0’s begin and draw a
   line. (I call this the “Major Network Divide” or “MD” on the worksheet.)
2. Now copy all of the bits above the 1 bits in the Network mask, to the
   Network address.
3. For the rest of the bits in the Network address (the bits below the 0’s in the
   Network mask) write all 0’s.
                                               MD




                   Network Portion                       Host Portion
   Copy the bits from the Host IP Address            Write all 0’s below the 0’s in
   to the Major Network Address                      the Major Network Mask




                                                                                      100
Network: Determine First Host, Last Host, Broadcast Addresses
    Remember that the network mask separates the network portion of the address from
     the host portion.
            Major Network Mask: 255.255.0.0 or /16
    The network address has all 0’s in the host portion of the address
    The broadcast address has all 1’s in the host portion of the address
    The first host is all 0’s and a 1 in the host portion of the address.
    The last host is all 1’s and a 0 in the host portion of the address.




                     Network Portion                        Host Portion




                                                                                        101
Network: Determine First Host, Last Host, Broadcast Addresses
     The network address has all 0’s in the host portion of the address
     The broadcast address has all 1’s in the host portion of the address
     The first host is all 0’s and a 1 in the host portion of the address.
     The last host is all 1’s and a 0 in the host portion of the address.




                       Network Portion                         Host Portion




                                                                              102
Network: Determine the number of usable hosts
 By counting the number of host bits we can determine the total number of usable hosts for
  this network (before subnetting).
  Host bits: 16
  Total number of hosts:
         216 = 65,536
         65,536 – 2 = 65,534 (Can’t use the all 0’s address, network address, or the all 1’s
         address, broadcast address.)




                    Network Portion
                                                                  Host Portion = 16 bits




                                                                                          103
Part 2: Determine Subnet Information




                                       104
Convert IP Address/Subnet Mask to Binary
 Now we will determine the Subnet Network Information. (Assuming we are
  subnetted.)
 This is the information only for that subnet.
 Using the Subnet Mask, determine the Subnet Address, the broadcast address for
  the entire network, and the number of hosts for the subnet.
 The Subnet Mask is determined by the network administrator, depending upon the
  number of subnets and the number of hosts per subnet that are needed.
 Convert these addresses to binary.
         Host IP Address: 138.101.114.250
         Subnet Mask:        255.255.255.192 (/26)




                                                                                   105
    Determine Subnet Address
    Determine the Network Address by using the AND operation.
    Perform a bit-wise AND operation on the IP Address and the Subnet Mask
    Note: 1 AND 1 results in a 1, 0 AND anything results in a 0
    Express the result in Dotted Decimal Notation
    The result is the Major Network Address of this for this host IP Address is
     138.101.114.192




                                                                                   106
 Determine Subnet Address
A simple way of doing the AND operation:
1. In the Subnet mask locate where the 1’s end and the 0’s begin and draw a line. (I call
    this the “Subnet Divide” or “SD” on the worksheet.)
2. Now copy all of the bits above the 1 bits in the Subnet mask, to the Network address.
3. For the rest of the bits in the Subnet address (the bits below the 0’s in the Network
    mask) write all 0’s.


                                                                              SD




                                             Network/Subnet Portion                 Host
                                                                                    Portion
           Copy the bits from the Host IP
           Address to the Major Network
           Address                                          Write all 0’s below the 0’s in
                                                            the Major Network Mask



                                                                                              107
 Subnet: Determine First Host, Last Host, Broadcast Addresses
 Remember that the network mask separates the network portion of the address from
  the host portion.
         Subnet Mask: 255.255.255.192 or /26
 The network address has all 0’s in the host portion of the address
 The broadcast address has all 1’s in the host portion of the address
 The first host is all 0’s and a 1 in the host portion of the address.
 The last host is all 1’s and a 0 in the host portion of the address.




                           Network Portion          Subnet Portion
                                                                              Host
                                                                              Portion




                                                                                        108
Subnet: Determine First Host, Last Host, Broadcast Addresses
   The subnet address has all 0’s in the host portion of the subnet address
   The broadcast address has all 1’s in the host portion of the subnet address
   The first host is all 0’s and a 1 in the host portion of the subnet address.
   The last host is all 1’s and a 0 in the host portion of the subnet address.




                  Network Portion                 Subnet Portion
                                                                              Host
                                                                              Portion




                                                                                        109
Subnet: Determine the number of usable hosts
 By counting the number of host bits we can determine the total number of usable
  hosts for this subnet.
  Host bits: 6
  Total number of hosts:
         26 = 64
         64 – 2 = 62 (Can’t use the all 0’s address, network address, or the all 1’s
         address, broadcast address.)                                        SD




                Network Portion                    Subnet Portion
                                                                                Host
                                                                                Portion




                                                                                          110
Subnet: Determine the number of usable subnets
 By counting the number of subnet bits we can determine the total number of usable hosts
  for this subnet.
  Subnet bits: 10
  Total number of hosts:
          210 = 1,024
          1,024 – (0, 1, or 2) = ?                 1,024 – 1 = 1,023 usable subnets
 The number of usable subnets depends upon whether or not we can use the first and/or
  last subnets. In today’s networks, both the first and last subnets are generally usable.
 In this example, the network administrator has determined the last subnet is not to be used.
                                                 MD                          SD




                    Network Portion
                                                    Subnet Portion              Host
                                                                                Portion


                                                                                           111
Overall Visual
   The subnet address has all 0’s in the host portion of the subnet address
   The broadcast address has all 1’s in the host portion of the subnet address
   The first host is all 0’s and a 1 in the host portion of the subnet address.
   The last host is all 1’s and a 0 in the host portion of the subnet address.




                                                                                   112
Overall Visual
The following information must be provided:
 IP Address (host or network)
 Major Network Mask
If subnetted:
 Subnet Mask
 Number of usable subnets (less 0, 1, or 2)




                                               113
 Notes
Quick check
 First host: 1 more than network/subnet address
 Last host: 1 less than broadcast
 Does the host IP address fall in the range of network host
  addresses? Of subnet host addresses?

How do hosts view the network?
 Hosts receive a host IP address and mask.
 Hosts only see themselves as part of their subnet (or network if not
  subnetted).
 They don’t know or care if they are in a network or subnet.
 Almost all networks are a subnet of some larger network.




                                                                         114
 See these spreadsheets on my website

                              Nutshell: Classless
                              Subnetting in a Nutshell
                              (Excel spreadsheet)




Worksheet: Classless
Subnetting Worksheet (Excel
spreadsheet)

                                                         115
Tips
 Use worksheets
 Don’t do short-cuts unless you understand the process we just
  discussed and you know what you are doing.
 Only use a subnet calculator to check your answers.
    You must know how to subnet, then you can use the calculator.
    Interviews, exams, and certification exams do not allow subnet
      calculators.
 Practice, practice, practice!




                                                                      116
IPv4 Addresses – Part 3
Topics
   Calculating the number subnets/hosts needed
   VLSM (Variable Length Subnet Masks)
   Classful Subnetting
   IPv6
   ICMP: Ping and Traceroute




                                                  118
Calculating the number subnets/hosts
               needed
Calculating the number subnets/hosts needed




             172.16.1.0
             255.255.255.0
              Network    Host



 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 60 hosts per subnet


                                                        120
Calculating the number subnets/hosts needed


                                 Number of hosts per subnet



        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 0 0 0 0 0 0 0 0
                                          6 host bits
          Network            Host

 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 60 hosts per subnet


                                                              121
Calculating the number subnets/hosts needed




                                                       Number of subnets
        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 1 1 0 0 0 0 0 0          255.255.255.192

                                         6 host bits
          Network            Host
 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 60 hosts per subnet
 New Subnet Mask: 255.255.255.192 (/26)
    Number of Hosts per subnet: 6 bits, 64-2 hosts, 62 hosts
    Number of Subnets: 2 bits or 4 subnets                                122
Calculating the number subnets/hosts needed




             172.16.1.0
             255.255.255.0
              Network    Host



 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 12 hosts per subnet


                                                        123
Calculating the number subnets/hosts needed


                                             Number of hosts per subnet



        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 0 0 0 0 0 0 0 0
                                         4 host bits
          Network            Host

 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 12 hosts per subnet


                                                                      124
Calculating the number subnets/hosts needed


                                             Number of hosts per subnet


                                             Number of subnets
        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 1 1 1 1 0 0 0 0          255.255.255.240

                                         4 host bits
          Network            Host
 Network 172.16.1.0/24
 Need:
    As many subnets as possible, 12 hosts per subnet
 New Subnet Mask: 255.255.255.240 (/28)
    Number of Hosts per subnet: 4 bits, 16-2 hosts, 14 hosts
    Number of Subnets: 4 bits or 16 subnets                          125
Calculating the number subnets/hosts needed




             172.16.1.0
             255.255.255.0
              Network    Host



 Network 172.16.1.0/24
 Need:
    Need 6 subnets, as many hosts per subnet as possible


                                                            126
Calculating the number subnets/hosts needed




                                              Number of subnets
        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 0 0 0 0 0 0 0 0
      3 subnet bits
          Network            Host

 Network 172.16.1.0/24
 Need:
    Need 6 subnets, as many hosts per subnet as possible


                                                                  127
Calculating the number subnets/hosts needed


                      Number of hosts per subnet


                                                   Number of subnets
        172.16.1. 0 0 0 0 0 0 0 0

    255.255.255. 1 1 1 0 0 0 0 0             255.255.255.224
      3 subnet bits
          Network              Host
 Network 172.16.1.0/24
 Need:
    Need 6 subnets, as many hosts per subnet as possible
 New Subnet Mask: 255.255.255.224 (/27)
    Number of Hosts per subnet: 5 bits, 32-2 hosts, 30 hosts
    Number of Subnets: 3 bits or 8 subnets                            128
VLSM (Variable Length Subnet Masks)
VLSM

 If you know how to subnet, you can do VLSM.

 Example: 10.0.0.0/8
    Subnet in /16 subnets:
    10.0.0.0/16
    10.1.0.0/16
    10.2.0.0/16
    10.3.0.0/16
    Etc.
       Subnet one of the subnets (10.1.0.0/16)
       10.1.0.0/24
       10.1.1.0/24
       10.1.2.0/24
       10.1.3.0/24
       etc
                                                  130
                     Host can only be a member
VLSM                 of the subnet. Host can NOT
                     be a member of the network
                     that was subnetted.

                                         YES!


                                       10.2.1.55/24




                                       10.2.1.55/16



                                         NO!
All other /16
subnets are still
available for use
as /16 networks or
to be subnetted.


                                                131
VLSM – Using the chart
 This chart can be used to help
  determine subnet addresses.
 This can any octet.
 We’ll keep it simple and make it the
  fourth octet.

 Network: 172.16.1.0/24
    What if we needed 10 subnets with a
     minimum of 12 hosts?
    What would the Mask be?
    What would the addresses of each
     subnet be?
    What would the range of hosts be for
     each subnet?

                                            132
    VLSM – Using the chart
 Network: 172.16.1.0/24
    What if we needed 5 subnets?
    What would the Mask be?
       255.255.255.240 (/27)
    What would the addresses of each subnet be?
       172.16.1.0/27
       172.16.1.32/27
       172.16.1.64/27
       172.16.1.96/27
       172.16.1.128/27
       172.16.1.160/27
       172.16.1.192/27
       172.16.1.224/27

     What would the range of valid hosts for each subnet?
        172.16.1.0/27: 172.16.1.1-172.16.1.31
        172.16.1.32/27: 172.16.1.33-172.16.1.62
        172.16.1.64/27: 172.16.1.65-172.16.1.94
        172.16.1.96/27: 172.16.1.97-172.16.1.126
        Etc.                                                133
                                                              16 /30 subnets

   VLSM – Using the chart
 What if we needed several (four) /30 subnets for our
  serial links?
 Take one of the /27 subnets and subnet it again into
  /30 subnets.                                                            Still
                                                                          have 7
                                                                          /27
                                                                          subnets




                                                         16 /30 subnets



                                                                               134
Classful Subnetting
Classful IP Addressing



 In the early days of the Internet, IP addresses were allocated to
  organizations based on request rather than actual need.
 When an organization received an IP network address, that address was
  associated with a “Class”, A, B, or C.
 This is known as Classful IP Addressing
 The first octet of the address determined what class the network belonged
  to and which bits were the network bits and which bits were the host bits.
 There were no subnet masks.
 It was not until 1992 when the IETF introduced CIDR (Classless
  Interdomain Routing), making the address class meaning less.
 This is known as Classless IP Addressing.
 For now, all you need to know is that today’s networks are classless, except
  for some things like the structure of Cisco’s IP routing table and for those
  networks that still use Classful routing protocols.
 You will learn more about this is CIS 82, CIS 83 and CIS 185.                  136
IPv4 Address Classes




                       137
Address Classes

           1st octet   2nd octet   3rd octet   4th octet
Class A   Network       Host        Host        Host
Class B   Network Network           Host        Host

Class C   Network Network Network               Host

  N = Network number assigned by ARIN
        (American Registry for Internet Numbers)
  H = Host number assigned by administrator




                                                           138
                                                Default Mask: 255.0.0.0 (/8)
Class A addresses
              First octet is between 0 – 127, begins with 0

              Network             Host            Host             Host

                                 8 bits           8 bits          8 bits
                                       With 24 bits available for hosts,
             Number
          between 0 - 127              there a 224 possible addresses.
                                       That’s 16,777,216 nodes!
 There are 126 class A addresses.
     0 and 127 have special meaning and are not used.
 16,777,214 host addresses, one for network address and one for broadcast address.
 Only large organizations such as the military, government agencies, universities, and
  large corporations have class A addresses.
 For example ISPs have 24.0.0.0 and 63.0.0.0
 Class A addresses account for 2,147,483,648 of the possible IPv4 addresses.
 That’s 50 % of the total unicast address space, if classful was still used in the Internet!
                                                                                                139
                                   Default Mask: 255.255.0.0 (/16)
Class B addresses
         First octet is between 128 – 191, begins with 10

         Network Network               Host          Host

                                       8 bits        8 bits
                              With 16 bits available for hosts,
         Number
         between              there a 216 possible addresses.
         128 - 191            That’s 65,536 nodes!
  There are 16,384 (214) class B networks.
  65,534 host addresses, one for network address and one for broadcast
   address.
  Class B addresses represent 25% of the total IPv4 unicast address space.
  Class B addresses are assigned to large organizations including corporations
   (such as Cisco, government agencies, and school districts).
                                                                                  140
                                   Default Mask: 255.255.255.0 (/24)
Class C addresses
        First octet is between 192 – 223, begins with 110

        Network Network Network                     Host

                                                   8 bits
                             With 8 bits available for hosts,
         Number              there a 28 possible addresses.
         between
         192 - 223
                             That’s 256 nodes!


   There are 2,097,152 possible class C networks.
   254 host addresses, one for network address and one for broadcast
    address.
   Class C addresses represent 12.5% of the total IPv4 unicast address
    space.                                                                141
IPv4 Address Classes




 No medium size host networks
 In the early days of the Internet, IP addresses were allocated to
  organizations based on request rather than actual need.
                                                                      142
Network based on first octet




 The network portion of the IP address was dependent upon the first octet.
 There was no “Base Network Mask” provided by the ISP.
 The network mask was inherent in the address itself.




                                                                              143
IPv4 Address Classes




Class D Addresses
 A Class D address begins with binary 1110 in the first octet.
 First octet range 224 to 239.
 Class D address can be used to represent a group of hosts called a host
   group, or multicast group.

Class E Addresses
   First octet of an IP address begins with 1111
 Class E addresses are reserved for experimental purposes and should not
   be used for addressing hosts or multicast groups.
                                                                            144
  Fill in the information…
1. 192.168.1.3       Class _____ Default Mask:______________
Network: _________________       Broadcast: ________________
Hosts: _________________ through ___________________

2. 1.12.100.31       Class ______ Default Mask:______________
Network: _________________        Broadcast: ________________
Hosts: _________________ through _____________________

3. 172.30.77.5       Class ______ Default Mask:______________
Network: _________________        Broadcast: ________________
Hosts: _________________ through _____________________




                                                                145
 Fill in the information…

1. 192.168.1.3       Class C     Default Mask: 255.255.255.0
Network: 192.168.1.0             Broadcast: 192.168.1.255
Hosts: 192.168.1.1 through 192.168.1.254

2. 1.12.100.31          Class A        Default Mask: 255.0.0.0
Network: 1.0.0.0                               Broadcast: 1.255.255.255
Hosts: 1.0.0.1     through   1.255.255.254

3. 172.30.77.5        Class B     Default Mask: 255.255.0.0
Network: 172.30.0.0               Broadcast: 172.30.255.255
Hosts: 172.30.0.1. through 172.30.255.254



                                                                      146
 Class separates network from host bits
 The Class determines the Base Network Mask!

1. 192.168.1.3    Class C     Default Mask: 255.255.255.0
                              Network: 192.168.1.0



2. 1.12.100.31    Class A     Default Mask: 255.0.0.0
                              Network: 1.0.0.0



3. 172.30.77.5    Class B     Default Mask: 255.255.0.0
                              Network: 172.30.0.0



                                                            147
Know the classes!
        First   First       Network   Host
Class    Bits   Octet        Bits     Bits

 A       0      0 – 127        8       24

 B       10     128 - 191     16       16

 C       110    192 - 223     24        8

 D       1110   224 – 239

 E       1111   240 - 255
                                             148
IP addressing crisis




    Address Depletion
    Internet Routing Table Explosion
                                        149
IPv4 Addressing




Subnet Mask
 One solution to the IP address shortage was thought to be the subnet
  mask.
 Formalized in 1985 (RFC 950), the subnet mask breaks a single class A, B
  or C network in to smaller pieces.
 This does allow a network administrator to divide their network into subnets.
 Routers still associated an network address with the first octet of the IP
  address.
                                                                                  150
All Zeros and All Ones Subnets
Using the All Ones Subnet
 There is no command to enable or disable the use of the all-ones subnet,
  it is enabled by default.
         Router(config)#ip subnet-zero
 The use of the all-ones subnet has always been explicitly allowed and the
  use of subnet zero is explicitly allowed since Cisco IOS version 12.0.


RFC 1878 states, "This practice (of excluding all-zeros and all-ones
  subnets) is obsolete! Modern software will be able to utilize all definable
  networks." Today, the use of subnet zero and the all-ones subnet is
  generally accepted and most vendors support their use, though, on
  certain networks, particularly the ones using legacy software, the use of
  subnet zero and the all-ones subnet can lead to problems.


CCO: Subnet Zero and the All-Ones Subnet
  http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note091
  86a0080093f18.shtml
                                                                                151
Long Term Solution: IPv6 (coming)

 IPv6, or IPng (IP – the Next Generation) uses a 128-bit address
  space, yielding
   340,282,366,920,938,463,463,374,607,431,768,211,456
                possible addresses.
 IPv6 has been slow to arrive
 IPv6 requires new software; IT staffs must be retrained
 IPv6 will most likely coexist with IPv4 for years to come.
 Some experts believe IPv4 will remain for more than 10 years.




                                                                    152
Short Term Solutions: IPv4 Enhancements




Discussed in CIS 83 and CIS 185
 CIDR (Classless Inter-Domain Routing) – RFCs 1517, 1518, 1519, 1520
 VLSM (Variable Length Subnet Mask) – RFC 1009
 Private Addressing - RFC 1918
 NAT/PAT (Network Address Translation / Port Address Translation) – RFC
     More later when we discuss TCP


                                                                           153
  11111111.00000000.00000000.00000000    /8 (255.0.0.0)         16,777,216 host addresses
  11111111.10000000.00000000.00000000    /9 (255.128.0.0)       8,388,608 host addresses
ISPs no longer restricted to
  11111111.11000000.00000000.00000000   /10 (255.192.0.0)       4,194,304 host addresses
three classes. Can now
  11111111.11100000.00000000.00000000   /11 (255.224.0.0)       2,097,152 host addresses
allocate a large range of
  11111111.11110000.00000000.00000000   /12 (255.240.0.0)       1,048,576 host addresses
network addresses based
  11111111.11111000.00000000.00000000   /13 (255.248.0.0)       524,288 host addresses
on customer requirements
  11111111.11111100.00000000.00000000   /14 (255.252.0.0)       262,144 host addresses
  11111111.11111110.00000000.00000000   /15 (255.254.0.0)       131,072 host addresses
  11111111.11111111.00000000.00000000   /16 (255.255.0.0)       65,536 host addresses
  11111111.11111111.10000000.00000000   /17 (255.255.128.0)     32,768 host addresses
  11111111.11111111.11000000.00000000   /18 (255.255.192.0)     16,384 host addresses
  11111111.11111111.11100000.00000000   /19 (255.255.224.0)     8,192 host addresses
  11111111.11111111.11110000.00000000   /20 (255.255.240.0)     4,096 host addresses
  11111111.11111111.11111000.00000000   /21 (255.255.248.0)     2,048 host addresses
  11111111.11111111.11111100.00000000   /22 (255.255.252.0)     1,024 host addresses
  11111111.11111111.11111110.00000000   /23 (255.255.254.0)     512 host addresses
  11111111.11111111.11111111.00000000   /24 (255.255.255.0)     256 host addresses
  11111111.11111111.11111111.10000000   /25 (255.255.255.128)   128 host addresses
  11111111.11111111.11111111.11000000   /26 (255.255.255.192)   64 host addresses
  11111111.11111111.11111111.11100000   /27 (255.255.255.224)   32 host addresses
  11111111.11111111.11111111.11110000   /28 (255.255.255.240)   16 host addresses
  11111111.11111111.11111111.11111000   /29 (255.255.255.248)   8 host addresses
  11111111.11111111.11111111.11111100   /30 (255.255.255.252)   4 host addresses
  11111111.11111111.11111111.11111110   /31 (255.255.255.254)   2 host addresses
  11111111.11111111.11111111.11111111   /32 (255.255.255.255)   “Host Route”           154
Active BGP entries – March, 2006




http://bgp.potaroo.net/
                                   155
  ISP/NAP Hierarchy - “The Internet: Still hierarchical after all
  these years.” Jeff Doyle (Tries to be anyways!)
                                         NAP (Network Access Point)



                                             Network                Network
                                             Service                Service
                                             Provider               Provider




      Regional                                 Regional       Regional                                     Regional
      Service                                  Service        Service                                      Service
      Provider                                 Provider       Provider                                     Provider




      ISP            ISP          ISP               ISP           ISP              ISP           ISP             ISP




Subscribers      Subscribers   Subscribers      Subscribers     Subscribers    Subscribers   Subscribers      Subscribers
                                                                                                                            156
IPv6
Why Do We Need a Larger Address Space?
 Internet population
    Approximately 973 million users in November 2005
    Emerging population and geopolitical and address space
 Mobile users
    PDA, pen-tablet, notepad, and so on
    Approximately 20 million in 2004
 Mobile phones
    Already 1 billion mobile phones delivered by the industry
 Transportation
    1 billion automobiles forecast for 2008
    Internet access in planes – Example: Lufthansa
 Consumer devices
    Sony mandated that all its products be IPv6-enabled by 2005
    Billions of home and industrial appliances



                                                                   158
IP Address Allocation History
        100%
         90%
         80%
         70%
         60%
         50%
         40%
         30%
         20%
         10%
          0%
               1980   1985   1990   1995   2000   2005   2010

1981, IPv4 Protocol was published.
1985, 1/16 of IPv4 address space in use.
2001, 2/3 of IPv4 address space in use.                         159
Larger Address Space




 IPv4
  32 bits or 4 bytes long
         4,200,000,000 possible addressable nodes
 IPv6
  128 bits or 16 bytes: four times the bits of IPv4
          3.4 * 1038 possible addressable nodes
          340,282,366,920,938,463,374,607,432,768,211,456
          5 * 1028 addresses per person
                 50,000,000,000,000,000,000,000,000,000

                                                            160
Larger Address Space Enables Address
Aggregation




  Aggregation of prefixes announced in the global routing table
  Efficient and scalable routing                                  161
IPv6
 Address assignment features: Using DHCP and Stateless
  Autoconfiguration.
 Built-in Support for Mobility: IPv6 supports mobility such that IPv6
  hosts can move around the Internetwork, retain their IPv6 address and
  without losing current application sessions.
 Aggregation: IPv6’s huge address space makes for much easier
  aggregation of blocks of addresses in the Internet, making routing in
  the Internet more efficient.
 No need for NAT/PAT: The huge public IPv6 address space removes
  the need for NAT/PAT, which avoids some NAT-induced application
  problems and makes for more efficient routing.
 No Broadcasts: IPv6 does not use layer 3 broadcast addresses,
  instead relying on multicasts to reach multiple hosts.
 Transition tools: IPv6 has many rich tools to help with the transition
  from IPv4 to IPv6.

                                                                           162
Three types of IPv6 Addresses



The three types of IPv6 address follow:
1. Unicast
    Global Unicast
    Link Local Unicast
    Unique Local Unicast
2. Multicast
3. Anycast

   Unlike IPv4, there is no IPv6 broadcast address.
   There is, however, an "all nodes" multicast address, which
    serves essentially the same purpose as a broadcast address.
                                                                  163
  Unicast Addresses




 A unicast address is an address that identifies a single device.
 A global unicast address is a unicast address that is globally unique.
    Has global scope.
    Globally unique and can therefore be routed globally with no modification.




                                                                                  164
Global Unicast Addresses
                                 Replaced
                                 with




 Note: This format, specified in RFC 3587, obsoletes and simplifies
  an earlier format that divided the IPv6 unicast address into Top
  Level Aggregator (TLA), Next-Level Aggregator (NLA), and other
  fields. However, you should be aware that this obsolescence is
  relatively recent and you are likely to encounter some books and
  documents that show the old IPv6 address format.



                                                                       165
Unicast Addresses




   The host portion of the address is called the Interface ID.
   Host can have more than one IPv6 interface
   Address more correctly identifies an interface on a host than a host itself.
   A single interface can have multiple IPv6 addresses, and can have an IPv4
    address in addition.




                                                                                   166
Unicast Addresses




 Another big difference between IPv4 addresses and IPv6 addresses:
  location of the Subnet Identifier
 Subnet Identifier is part of the network portion of the address rather than
  the host portion.




                                                                                167
Unicast Addresses




 The Interface ID is a consistent size for all IPv6 addresses, simplifying the
  parsing of the address.
 And making the Subnet ID a part of the network portion creates a clear
  separation of functions:
    The network portion provides the location of a device down to the specific
      data link
   and
    the host portion provides the identity of the device on the data link.


                                                                              168
Background



 IPv4 will exist for some time, as the transition begins to IPv6.
 Other new protocols have been developed in support of IPv6:
    Routing protocols (OSPFv3) so routers can learn about IPv6
     network addresses.
    ICMPv6




                                                                     169
ICMP
171
ICMP: Ping and Trace
Ethernet Header                  IP Header        ICMP Message                                Ether.
(Layer 2)                        (Layer 3)        (Layer 3)                                   Tr.
Ethernet      Ethernet   Frame   Source IP Add.   Type     Code   Check-   ID   Seq.   Data   FCS
Destination   Source     Type    Dest. IP Add.    0 or 8   0      sum           Num.
Address       Address            Protocol field
(MAC)         (MAC)




                     Partial list




ICMP (Internet Control Message Protocol)
 ICMP: A Layer 3 protocol
 Used for sending messages
 Encapsulated in a Layer 3, IP packet
 Uses Type and Code fields for various messages
                                                                                                       173
ICMP               Ethernet Header
                   (Layer 2)
                                                    IP Header
                                                    (Layer 3)
                                                                     ICMP Message
                                                                     (Layer 3)
                                                                                                                 Ether.
                                                                                                                 Tr.
                   Ethernet      Ethernet   Frame   Source IP Add.   Type     Code   Check-   ID   Seq.   Data   FCS
                   Destination   Source     Type    Dest. IP Add.    0 or 8   0      sum           Num.
                   Address       Address            Protocol field
                   (MAC)         (MAC)


Unreachable Destination or Service

 Used to notify a host that the destination or service is unreachable.
 When a host or router receives a packet that it cannot deliver, it may send
  an ICMP Destination Unreachable packet to the host originating the
  packet.
 The Destination Unreachable packet will contain codes that indicate why
  the packet could not be delivered.
   From a router:
    0 = network unreachable – Does not have a route in the routing table
    1 = host unreachable – Has a route but can’t find host. (end router)
   From a host:
    2 = protocol unreachable
    3 = port unreachable
         Service is not available because no daemon is running providing
          the service or because security on the host is not allowing access
          to the service.                                                                                              174
172.30.1.20   172.30.1.25




                            175
Ethernet Header                  IP Header        ICMP Message                                Ether.
(Layer 2)                        (Layer 3)        (Layer 3)                                   Tr.
Ethernet      Ethernet   Frame   Source IP Add.   Type     Code   Check-   ID   Seq.   Data   FCS
Destination   Source     Type    Dest. IP Add.    0 or 8   0      sum           Num.
Address       Address            Protocol field
(MAC)         (MAC)



Ping
 Uses ICMP message encapsulated within an IP Packet
     Protocol field = 1

 Does not use TCP or UDP

Format
 ping ip address (or ping <cr> for extended ping)
 ping 172.30.1.25




                                                                                                       176
Ethernet Header                  IP Header        ICMP Message - Echo Request               Ether.
(Layer 2)                        (Layer 3)        (Layer 3)                                 Tr.
Ethernet      Ethernet   Frame   Source IP        Type   Code   Check-   ID   Seq.   Data   FCS
Destination   Source     Type    Add.             8      0      sum           Num.
Address       Address            172.30.1.20
(MAC)         (MAC)              Dest. IP Add.
                                 172.30.1.25
                                 Protocol field
                                 1



Echo Request
 The sender of the ping, transmits an ICMP message, “Echo Request”

Echo Request - Within ICMP Message
 Type = 8
 Code = 0




                                                                                                     177
Ethernet Header                  IP Header        ICMP Message - Echo Reply                 Ether.
(Layer 2)                        (Layer 3)        (Layer 3)                                 Tr.
Ethernet      Ethernet   Frame   Source IP        Type   Code   Check-   ID   Seq.   Data   FCS
Destination   Source     Type    Add.             0      0      sum           Num.
Address       Address            172.30.1.25
(MAC)         (MAC)              Dest. IP Add.
                                 172.30.1.20
                                 Protocol field
                                 1



 Echo Reply
  The IP address (destination) of the ping, receives the ICMP message,
   “Echo Request”
  The ip address (destination) of the ping, returns the ICMP message, “Echo
   Reply”

 Echo Reply - Within ICMP Message
  Type = 0
  Code = 0




                                                                                                     178
Ping example




               179
Pings
may fail




Q: Are pings forwarded by routers?
A: Yes! This is why you can ping devices all over the Internet.

Q: Do all devices forward or respond to pings?
A: No, this is up to the network administrator of the device. Devices,
   including routers, can be configured not to reply to pings (ICMP echo
   requests). This is why you may not always be able to ping a device. Also,
   routers can be configured not to forward pings destined for other devices.   180
Traceroute




 Traceroute is a utility that records the route (router IP addresses) between
  two devices on different networks.




                                                                                 181
Tracroute
 http://en.wikipedia.org/wiki/Traceroute
 On modern Unix and Linux-based operating systems, the traceroute utility
  by default uses UDP datagrams with a destination port number starting at
  33434.
 The traceroute utility usually has an option to specify use of ICMP echo
  request (type 8) instead.
 The Windows utility uses ICMP echo request, better known as ping
  packets.
 Some firewalls on the path being investigated may block UDP probes but
  allow the ICMP echo request traffic to pass through.
 There are also traceroute implementations sending out TCP packets, such
  as tcptraceroute or Layer Four Trace.
 In Microsoft Windows, traceroute is named tracert.
 A new utility, pathping, was introduced with Windows NT, combining ping
  and traceroute functionality. All these traceroutes rely on ICMP (type 11)
  packets coming back.

                                                                               182
Trace (Traceroute)



 Trace ( Cisco = traceroute, tracert,…) is used to trace the probable path a
  packet takes between source and destination.
 Probable, because IP is a connectionless protocol, and different packets may
  take different paths between the same source and destination networks,
  although this is not usually the case.
 Trace will show the path the packet takes to the destination, but the return path
  may be different.
    This is more likely the case in the Internet, and less likely within your own
      autonomous system.
 Linux/Unix Systems
    Uses ICMP message within an IP Packet
    Both are layer 3 protocols.
    Uses UDP as a the transport layer.
    We will see why this is important in a moment.
                                                                                  183
Trace
                    10.0.0.0/8                   172.16.0.0/16           192.168.10.0/24
     RTA                              RTB                         RTC                      RTD


               .1                .2         .1               .2         .1            .2




Format (trace, traceroute, tracert)
 RTA# traceroute ip address

RTA# traceroute 192.168.10.2




                                                                                                 184
Trace
                              10.0.0.0/8                       172.16.0.0/16             192.168.10.0/24
            RTA                                   RTB                           RTC                            RTD


                         .1                .2             .1               .2           .1            .2

                     DA = 192.168.10.2, TTL = 1




Data Link Header                    IP Header           ICMP Message - Echo Request (trace)                UDP         DataLink
(Layer 2)                           (Layer 3)                                                              (Layer 4)   Tr.
Data Link    Data Link   ……         Source IP           Type         Chk        ID    Seq.    Data         DestPort    FCS
Destination  Source                 Add.                8            sum              Num                  35,000
Address      Address                10.0.0.1
                                    Dest. IP Add.       Code
                                    192.168.10.2        0
                                    Protocol field
                                    1
                                    TTL
                                    1



How it works (using UDP) - Fooling the routers & host!
 Traceroute uses ping (echo requests)
 Traceroute sets the TTL (Time To Live) field in the IP Header, initially to “1”
 When a router receives an IP Packet, it decrements the TTL by 1.
 If the TTL is 0, it will not forward the IP Packet, and send back to the source
  an ICMP “time exceeded” message.                                                                                                185
Trace
                              10.0.0.0/8                       172.16.0.0/16           192.168.10.0/24
          RTA                                       RTB                         RTC                       RTD


                         .1                .2             .1               .2         .1            .2

                   DA = 192.168.10.2, TTL = 1

                ICMP Time Exceeded, SA = 10.0.0.2




Data Link Header                       IP Header               ICMP Message - Time Exceeded              DataLink
(Layer 2)                              (Layer 3)                                                         Tr.
Data Link    Data Link        ….       Source IP               Type       Chk   ID    Seq    Data        FCS
Destination  Source                    Add.                    11         sum         .
Address      Address                   10.0.0.2                                       Nu
                                       Dest. IP Add.           Code                   m.
                                       10.0.0.1                0
                                       Protocol field
                                       1



RTB - TTL:
 When a router receives an IP Packet, it decrements the TTL by 1.
 If the TTL is 0, it will not forward the IP Packet, and send back to the
  source an ICMP “time exceeded” message.
 ICMP Message: Type = 11, Code = 0
                                                                                                                    186
                             10.0.0.0/8                         172.16.0.0/16           192.168.10.0/24
          RTA                                       RTB                          RTC                        RTD


                        .1                 .2              .1               .2         .1            .2

                   DA = 192.168.10.2, TTL = 1

                ICMP Time Exceeded, SA = 10.0.0.2



Data Link Header                          IP Header              ICMP Message - Time Exceeded             DataLink
(Layer 2)                                 (Layer 3)                                                       Tr.
Data Link    Data Link       ….           Source IP              Type      Chk   ID    Seq   Data         FCS
Destination  Source                       Add.                   11        sum         .
Address      Address                      10.0.0.2                                     Nu
                                          Dest. IP Add.          Code                  m.
                                          10.0.0.1               0
                                          Protocol field
                                          1




RTB
 Sends back a ICMP Time Exceeded message back to the source, using its
  IP address for the source IP address.
 Router B’s IP header includes its own IP address (source IP) and the sending
  host’s IP address (dest. IP).




                                                                                                                     187
                             10.0.0.0/8                         172.16.0.0/16           192.168.10.0/24
          RTA                                       RTB                          RTC                        RTD


                        .1                 .2              .1               .2         .1            .2

                   DA = 192.168.10.2, TTL = 1

                ICMP Time Exceeded, SA = 10.0.0.2



Data Link Header                          IP Header              ICMP Message - Time Exceeded             DataLink
(Layer 2)                                 (Layer 3)                                                       Tr.
Data Link    Data Link       ….           Source IP              Type      Chk   ID    Seq   Data         FCS
Destination  Source                       Add.                   11        sum         .
Address      Address                      10.0.0.2                                     Nu
                                          Dest. IP Add.          Code                  m.
                                          10.0.0.1               0
                                          Protocol field
                                          1



  RTA, Sending Host
   The traceroute program of the sending host (RTA) will use the source IP
    address of this ICMP Time Exceeded packet to display at the first hop.

  RTA# traceroute 192.168.10.2
  Type escape sequence to abort.
  Tracing the route to 192.168.10.2
    1 10.0.0.2 4 msec 4 msec 4 msec

                                                                                                                     188
                           10.0.0.0/8                        172.16.0.0/16            192.168.10.0/24
       RTA                                        RTB                         RTC                          RTD


                      .1                .2              .1               .2          .1              .2

                 DA = 192.168.10.2, TTL = 1

              ICMP Time Exceeded, SA = 10.0.0.2



                  DA = 192.168.10.2, TTL = 2



Data Link Header                     IP Header          ICMP Message - Echo Request (trace)               UDP         DataLink
(Layer 2)                            (Layer 3)                                                            (Layer 4)   Tr.
Data Link    Data Link     ……        Source IP          Type           Chk      ID    Seq.    Data        DestPort    FCS
Destination  Source                  Add.               8              sum            Num                 35,000
Address      Address                 10.0.0.1
                                     Dest. IP Add.      Code
                                     192.168.10.2       0
                                     Protocol field
                                     1
                                     TTL
                                     2




RTA
 The traceroute program increments the TTL by 1 (now 2 ) and resends the
  ICMP Echo Request packet.

                                                                                                                                 189
                          10.0.0.0/8                        172.16.0.0/16           192.168.10.0/24
       RTA                                       RTB                         RTC                      RTD


                     .1                .2              .1               .2         .1            .2

                DA = 192.168.10.2, TTL = 1

             ICMP Time Exceeded, SA = 10.0.0.2



                 DA = 192.168.10.2, TTL = 2

               ICMP Time Exceeded, SA = 172.16.0.2




RTB
 This time RTB decrements the TTL by 1 and it is NOT 0. (It is 1.)
 So it looks up the destination ip address in its routing table and forwards it on to
  the next router.
RTC
 RTC however decrements the TTL by 1 and it is 0.
 RTC notices the TTL is 0 and sends back the ICMP Time Exceeded message
  back to the source.
 RTC’s IP header includes its own IP address (source IP) and the sending host’s
  IP address (destination IP address of RTA).
 The sending host, RTA, will use the source IP address of this ICMP Time
  Exceeded message to display at the second hop.
                                                                                                            190
                                                      10.0.0.0/8                             172.16.0.0/16                        192.168.10.0/24
                              RTA                                             RTB                                    RTC                                   RTD


                                               .1                  .2                   .1                    .2                 .1                 .2

                                           DA = 192.168.10.2, TTL = 1

                                      ICMP Time Exceeded, SA = 10.0.0.2



                                           DA = 192.168.10.2, TTL = 2

                                         ICMP Time Exceeded, SA = 172.16.0.2


          RTA to RTB
Data Link Header              IP Header        ICMP Message - Echo Request (trace)                     UDP           DataLink
(Layer 2)                     (Layer 3)                                                                (Layer 4)     Tr.
Data Link    Data Link   ……   Source IP        Type        Chk           ID     Seq.         Data      DestPort      FCS
Destination  Source           Add.             8           sum                  Num                    35,000
Address      Address          10.0.0.1
                              Dest. IP Add.    Code
                              192.168.10.2     0
                              Protocol field
                              1
                              TTL
                              2

                                                    RTB to RTC
                                        Data Link Header                      IP Header             ICMP Message - Echo Request (trace)              UDP         DataLink
                                        (Layer 2)                             (Layer 3)                                                              (Layer 4)   Tr.
                                        Data Link    Data Link     ……         Source IP             Type       Chk        ID     Seq.        Data    DestPort    FCS
                                        Destination  Source                   Add.                  8          sum               Num                 35,000
                                        Address      Address                  10.0.0.1
                                                                              Dest. IP Add.         Code
                                                                              192.168.10.2          0
                                                                              Protocol field
                                                                              1
                         .                                                    TTL
                                                                              1

                                                                                                                                 RTC to RTA
                                         Data Link Header                      IP Header             ICMP Message - Time Exceeded             DataLink
                                         (Layer 2)                             (Layer 3)                                                      Tr.
                                         Data Link    Data Link     ….         Source IP             Type     Chk    ID    Seq        Data    FCS
                                         Destination  Source                   Add.                  11       sum          .
                                         Address      Address                  172.16.0.2                                  Nu
                                                                               Dest. IP Add.         Code                  m.
                                                                               10.0.0.1              0
                                                                               Protocol field
                                                                               1
                                                                                                                                                                            191
                        10.0.0.0/8                          172.16.0.0/16                   192.168.10.0/24
    RTA                                        RTB                                  RTC                       RTD


                   .1                .2                .1                 .2               .1            .2

              DA = 192.168.10.2, TTL = 1

           ICMP Time Exceeded, SA = 10.0.0.2



               DA = 192.168.10.2, TTL = 2

             ICMP Time Exceeded, SA = 172.16.0.2


  Data Link Header                    IP Header             ICMP Message - Time Exceeded           DataLink
  (Layer 2)                           (Layer 3)                                                    Tr.
  Data Link    Data Link    ….        Source IP             Type    Chk        ID    Seq   Data    FCS
  Destination  Source                 Add.                  11      sum              .
  Address      Address                172.16.0.2                                     Nu
                                      Dest. IP Add.         Code                     m.
                                      10.0.0.1              0
                                      Protocol field
                                      1




The sending host, RTA:
 The traceroute program uses this information (Source IP Address) and
   displays the second hop.

RTA# traceroute 192.168.10.2
Type escape sequence to abort.
Tracing the route to 192.168.10.2
  1 10.0.0.2 4 msec 4 msec 4 msec
  2 172.16.0.2 20 msec 16 msec 16 msec
                                                                                                                    192
                              10.0.0.0/8                      172.16.0.0/16                192.168.10.0/24
         RTA                                       RTB                         RTC                           RTD


                         .1                .2            .1               .2              .1            .2

                  DA = 192.168.10.2, TTL = 1

               ICMP Time Exceeded, SA = 10.0.0.2



                   DA = 192.168.10.2, TTL = 2

                 ICMP Time Exceeded, SA = 172.16.0.2



                  DA = 192.168.10.2, TTL = 3




Data Link Header                       IP Header          ICMP Message - Echo Request (trace)                 UDP         DataLink
(Layer 2)                              (Layer 3)                                                              (Layer 4)   Tr.
Data Link    Data Link        ……       Source IP          Type           Chk         ID        Seq.   Data    DestPort    FCS
Destination  Source                    Add.               8              sum                   Num            35,000
Address      Address                   10.0.0.1
                                       Dest. IP Add.      Code
                                       192.168.10.2       0
                                       Protocol field
                                       1
                                       TTL
                                       3


 The sending host, RTA:
  The traceroute program increments the TTL by 1 (now 3 ) and resends the
    Packet.


                                                                                                                                     193
                                                  10.0.0.0/8                          172.16.0.0/16                       192.168.10.0/24
                               RTA                                       RTB                                 RTC                                    RTD


                                             .1                .2                .1                .2                    .1                .2

                                        DA = 192.168.10.2, TTL = 1

                                     ICMP Time Exceeded, SA = 10.0.0.2



                                         DA = 192.168.10.2, TTL = 2

                                       ICMP Time Exceeded, SA = 172.16.0.2



                                        DA = 192.168.10.2, TTL = 3


RTA to RTB
      Data Link Header                     IP Header           ICMP Message - Echo Request (trace)                             UDP                DataLink
      (Layer 2)                            (Layer 3)                                                                           (Layer 4)          Tr.
      Data Link    Data Link    ……         Source IP           Type            Chk            ID      Seq.      Data           DestPort           FCS
      Destination  Source                  Add.                8               sum                    Num                      35,000
      Address      Address                 10.0.0.1
                                           Dest. IP Add.       Code
                                           192.168.10.2        0
                                           Protocol field
                                           1
                                           TTL
                                           3

                                                     RTB to RTC
                       Data Link Header                             IP Header          ICMP Message - Echo Request (trace)                            UDP            DataLink
                       (Layer 2)                                    (Layer 3)                                                                         (Layer 4)      Tr.
                       Data Link    Data Link         ……            Source IP          Type           Chk           ID         Seq.        Data       DestPort       FCS
                       Destination  Source                          Add.               8              sum                      Num                    35,000
                       Address      Address                         10.0.0.1
                                                                    Dest. IP Add.      Code
                                                                    192.168.10.2       0
                                                                    Protocol field
                                                                    1
                                                                    TTL
                                                                    2
       .
                                                                                RTC to RTD
                                            Data Link Header                           IP Header             ICMP Message - Echo Request (trace)                       UDP         DataLink
                                            (Layer 2)                                  (Layer 3)                                                                       (Layer 4)   Tr.
                                            Data Link    Data Link          ……         Source IP             Type             Chk          ID       Seq.      Data     DestPort    FCS
                                            Destination  Source                        Add.                  8                sum                   Num                35,000
                                            Address      Address                       10.0.0.1
                                                                                       Dest. IP Add.         Code
                                                                                       192.168.10.2          0
                                                                                       Protocol field
                                                                                       1
                                                                                       TTL
                                                                                       1
                                                                                                                                                                                     194
                                    10.0.0.0/8                        172.16.0.0/16           192.168.10.0/24
                 RTA                                       RTB                         RTC                      RTD


                               .1                .2              .1               .2         .1            .2

                          DA = 192.168.10.2, TTL = 1

                       ICMP Time Exceeded, SA = 10.0.0.2



                           DA = 192.168.10.2, TTL = 2

                         ICMP Time Exceeded, SA = 172.16.0.2



                          DA = 192.168.10.2, TTL = 3




RTB
 This time RTB decrements the TTL by 1 and it is NOT 0. (It is 2.)
 So it looks up the destination ip address in its routing table and forwards it on to the next
   router.
RTC
 This time RTC decrements the TTL by 1 and it is NOT 0. (It is 1.)
 So it looks up the destination ip address in its routing table and forwards it on to the next
   router.
RTD
 RTD however decrements the TTL by 1 and it is 0.
 However, RTD notices that the Destination IP Address of 192.168.0.2 is it’s own interface.
 Since it does not need to forward the packet, the TTL of 0 has no affect.


                                                                                                                      195
    Data Link Header               IP Header        ICMP Message - Echo Request (trace)                UDP         DataLink
    (Layer 2)                      (Layer 3)                                                           (Layer 4)   Tr.
    Data Link    Data Link   ……    Source IP        Type      Chk          ID        Seq.     Data     DestPort    FCS
    Destination  Source            Add.             8         sum                    Num               35,000
    Address      Address           10.0.0.1
                                   Dest. IP Add.    Code
                                   192.168.10.2     0
                                   Protocol field
                                   1
                                   TTL
                                   1




    Data Link Header                    IP Header          ICMP Message – Port Unreachable                 DataLink
    (Layer 2)                           (Layer 3)                                                          Tr.
    Data Link    Data Link    ….        Source IP          Type      Chk        ID      Seq     Data       FCS
    Destination  Source                 Add.               3         sum                .
    Address      Address                192.168.10.2                                    Nu
                                        Dest. IP Add.      Code                         m.
                                        10.0.0.1           3
                                        Protocol field
                                        1



RTD
 RTD sends the packet to the UDP process.
 UDP examines the unrecognizable port number of 35,000 and sends back an
  ICMP Port Unreachable message to the sender, RTA, using Type 3 and
  Code 3.

                                                                                                                              196
                                 10.0.0.0/8                           172.16.0.0/16                 192.168.10.0/24
             RTA                                       RTB                              RTC                           RTD


                           .1                 .2                 .1               .2            .1               .2

                       DA = 192.168.10.2, TTL = 1

                   ICMP Time Exceeded, SA = 10.0.0.2



                       DA = 192.168.10.2, TTL = 2

                     ICMP Time Exceeded, SA = 172.16.0.2



                      DA = 192.168.10.2, TTL = 3

                      ICMP Port Unreachable, SA = 192.168.10.2



        Data Link Header                      IP Header               ICMP Message – Port Unreachable          DataLink
        (Layer 2)                             (Layer 3)                                                        Tr.
        Data Link    Data Link     ….         Source IP               Type      Chk    ID     Seq     Data     FCS
        Destination  Source                   Add.                    3         sum           .
        Address      Address                  192.168.10.2                                    Nu
                                              Dest. IP Add.           Code                    m.
                                              10.0.0.1                3
                                              Protocol field
                                              1



Sending host, RTA
 RTA receives the ICMP Port Unreachable message.
 The traceroute program uses this information (Source IP Address) and
  displays the third hop.
 The traceroute program also recognizes this Port Unreachable message as
  meaning this is the destination it was tracing.
                                                                                                                            197
                               10.0.0.0/8                           172.16.0.0/16           192.168.10.0/24
            RTA                                       RTB                            RTC                      RTD


                          .1                .2                 .1               .2         .1            .2

                     DA = 192.168.10.2, TTL = 1

                  ICMP Time Exceeded, SA = 10.0.0.2



                      DA = 192.168.10.2, TTL = 2

                    ICMP Time Exceeded, SA = 172.16.0.2



                     DA = 192.168.10.2, TTL = 3

                    ICMP Port Unreachable, SA = 192.168.10.2




Sending host, RTA
 RTA, the sending host, now displays the third hop.
 Getting the ICMP Port Unreachable message, it knows this is the final hop
  and does not send any more traces (echo requests).

RTA# traceroute 192.168.10.2
Type escape sequence to abort.
Tracing the route to 192.168.10.2
  1 10.0.0.2 4 msec 4 msec 4 msec
  2 172.16.0.2 20 msec 16 msec 16 msec
  3 192.168.10.2 16 msec 16 msec 16 msec                                                                            198
Recommended Reading




 For more information on ICMP and other TCP/IP topics, I recommend:
  TCP/IP Illustrated, Volume I – R.W. Stevens
                                                                      199
   Chapter 6
IPv4 Addresses

     CNET 54A Networking Fundamentals
     Mike Murphy
     mike@foothill.edu

     Winter 2012

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:1
posted:12/18/2012
language:English
pages:200