Network Subnetting Guide
Network Subnetting Guide
                                    R2          Net
                                              130.11.0.0       R3                            Net_id-Host_id:
                                                                    213.2.97.0                 place host_id on physical network net_id
                                         R2 Routing Table                                    131.175.0.2 131.175.0.3                    131.175.45.54               131.175.255.254
                                                                    213.2.98.0
                                         dest        Next Hop
                                   130.11.0.0/16 Direct fwd
                                          …                …        213.2.99.0
                                   213.2.96.0/24 130.11.0.7
                                                                                                           131.175.0.1
                                   213.2.97.0/24 130.11.0.7         Corporate
                                   213.2.98.0/24 130.11.0.7                                                                     65534 hosts on a same physical network????
                                                                                         CLASS B:
                                                                                                                                 - performance?
                                   213.2.99.0/24 130.11.0.7                              From: 131.175.0.1
                                                                                                                                 - management?
                                                                                         To:    131.175.255.254
                          131.175.21.42             131.175.12.33
                                      131.175.12.12         131.175.12.34                                                                               131.175.12.0
                 131.175.21.4                                                                                                                            131.175.12.0
                                                                     131.175.12.254                                                                     131.175.21.0
                                                                                                                                                         131.175.21.0
  Router
                                                                                                       Internet                                         131.175.15.0
                Ethernet                                   FDDI                                                                                          131.175.15.0
                                                                          131.175.33.0
                                                                                                                                                        131.175.x.0
                                                                                                                                                         131.175.x.0
  Host                                                                                                                              131.175.0.0
                                              131.175.12.0
                                                                                                          !                              "                "     #        $ #%
              131.175.21.0      131.175.21.1
                                                                                                                            &
Sub-Net                                                             ATM                            !
                           Class B network: 131.175.0.0                                        '                                (                                   #
          May use third byte to identify subnet: 131.175.X.0 (or may not!)                     )                  !                                                             "
            Giuseppe Bianchi                                                                       Giuseppe Bianchi
                                                                                                                                                    1
                         Subnetting                                                               Subnet Address & Mask
                  Class B address example                                         "          !#
                                                                                      $%&     &%& '                                         &                &                 &
           network prefix                                                                    (                     )           )
         (network address)
                                                                                  * $ $ &* $$ & &                                           &                &                 &
                                                                                  +          , )
1 0            NET ID (14bit)                 HOST ID (16 bit)                          *                                                "+*                 !
                                                                                        ,                                    !              "-               !
                                                                              -                                                      $                  .
               Extended network prefix                                                               "./ 0
                  (subnet address)                                                                                                          &                &                 &
                                                                                            /prefix-length notation
                                                                                                     ".        &       & 1&2
                                                                                            (dot decimal notation)
1 0            NET ID (14bit)       SUBNET ID (n bit) HOST ID (16-n bit)              0 3&022&2&2 .        4                                &                &                 &
                                                                                      0 3&022&1&2 .                      "                             4 5          4
                                                                                      , (                   ! 0 3&022&1&2/ 0
      Giuseppe Bianchi                                                                        Giuseppe Bianchi
                                                                                      Class C address;
  128     64     32     16      8   4     2      1                                    Outside private domain routed with mask 255.255.255.0
  1       0      0      0       0   0    0      0       = 128                                                      network                                           host
                                                                                                                                                             2
           Subnet routing – 2nd example                                                                                                        Router configuration
       Core routers unaware of subnetting – route via class mask
                                                                               …          …                                   Classful routing:                   Net = 162.12.0.0; subnet mask 255.255.255.224
           …          …                   …          …
        162.12.0.0 193.1.1.36          162.12.0.0 145.54.3.5                162.12.0.0 145.54.3.5                                All necessary information                                           To other nets
                                                                               …          …
           …          …                   …          …                                                                           included in Ipaddr
                                                                                                  162.12.2.33                 Subnet routing
162.12.34.75                                                     145.54.55.1                                                                                                                  162.12.1.11
                          193.1.1.36                                                                                             Specific subnet mask                            162.12.1.0
                                                                                                                                                                                                                      To other
                                                                                                      …           …                                                                                                   subnets
                                                                                                 162.12.34.64 162.12.1.1
                                                                                                                                 (set by admin) required                                           162.12.1.12
                                                          145.54.0.0
                                                           145.54.0.0              145.54.3.5                                                                          162.12.1.1
                   193.1.1.0
                    193.1.1.0                                                                     162.12.2.32 162.12.1.33           Routing Table
                                                                                                    default 162.12.9.65             Subnet mask:
                                                                                                                                   255.255.255.224                            162.12.34.65
                                                                                                                                                                                                162.12.70.96
                             193.1.1.1                                                                                                                                                           162.12.70.96
                                                                            162.12.1.33             162.12.9.65                   dest       Next Hop
                                                    162.12.1.1
                                                                                                                               162.12.1.0    Direct fwd
                                                                                                                                                                                                             162.12.35.128
                  …          …
                                                                         162.12.2.33                                         162.12.34.64    Direct fwd                                   162.12.34.66        162.12.35.128
                                                          162.12.34.75
                                                                                                                            162.12.35.128 162.12.34.66                    162.12.34.64
               162.12.0.0 193.1.1.36
                  …          …                                                                                               162.12.70.96 162.12.1.12
       routing tables in the                                  Net = 162.12.0.0
                                                                                                                              131.175.0.0 162.12.34.66       May be quite a complex
       Internet:                                       subnet mask = 255.255.255.224                                                                                                              To
                                                                                                                              131.176.0.0 162.12.34.66       Routing table…
          route according to net_id                   Corporate routers & hosts:                                                                                                                  131.175.0.0
                                                                                                                                default     162.12.1.11      VLSM will help (later)
          Use natural class mask                         Route according to subnet_id                                                                                                             131.176.0.0
                                                         Need to KNOW subnet mask
                  Giuseppe Bianchi                                                                                                      Giuseppe Bianchi
                                                  algebra                                                                                                          algebra
                                                  12 hosts                                                                                                      193.1.1.32/27
                                                                                                                                                                up to 30 hosts                           Computation
                                                                     A                                                                                              (33-62)           A                  193.1.1.64/27
                                                                                          Computation
                  Math dept                                                                 28 host                                      Math dept                                                       up to 30 hosts
                   22 hosts                                                                                                            193.1.1.96/27                                                         (65-94)
                                                 Link-1                                                                                up to 30 hosts             Link-1
                                         B                                                                                                (97-126)        B                            physics
                                                                     physics                                                                                                        193.1.1.160/27
                                                                     10 host                                                                                                        up to 30 hosts
                                                                                                                                                                                      (161-190)
Link-2 Link-2
C C
                                                 algebra
                                              193.1.1.32/27
                                              up to 29 hosts                              Computation
                                                  (33-62)            A                    193.1.1.64/27
                 Math dept
               193.1.1.96/27                  Link-1
                                                                                          up to 29 hosts
                                                                                              (65-94)
                                                                                                                                                     VLSM
               up to 29 hosts
                  (97-126)               B
                                          193.1.1.128/27
                                                                     physics                                                             Variable Length Subnet Mask
                                                                  193.1.1.160/27
Subnet mask:
/27     255.255.255.224
                                                 up to 28 hosts                                                                                RFC 1009 (1987)
                                                   (161-190)
SUBNETS:
Math    193.1.1.96/27            Link-2
                             193.1.1.192/27
Algebra 193.1.1.32/27
Physics 193.1.1.160/27
Comput 193.1.1.64/27                               C
Link-1 193.1.1.128/27
Link-2 193.1.1.192/27                193.1.1.0 network
---     193.1.1.0/27
---     193.1.1.224/27
            Giuseppe Bianchi                                                                                                            Giuseppe Bianchi
                                                                                                                                                                                                  3
                                                                                                                   A typical problem
      Variable Length Subnet Mask
       allows more than one subnet mask in the
                                                                                                                                                      A                          x-net-1
       same network                                                                               pc-net
                                                                                                                                                                                 20 host
                                                                                                 100 host
          A) more efficient use of organization’s IP address space
                                                                                                                                   Link-1
               Subnets may significantly vary in relative size (computer                                                      B
               room = 200 hosts, secretary = 4 hosts…)                                                                                                    Link-3
               consider a 4 host network with mask 255.255.255.0: wastes
               250 IP addresses!
                                                                                                                                  Link-2
         B) allows route aggregation, thus reducing routing                                       ws-net
                                                                                                  20 host
                                                                                                                                                                                 x-net-2
                                                                                                                                                                                 10 host
         information needed
                                                                                                                                                      C
       Needs further support by routing protocol
                                                                                             100+20+20+10 = 150 total hosts: 1 class C enough (including growth projections).
         e.g. RIP1 doesn’t support VLSM
                                                                                             7 subnets (4 LANS + 3 point to point links): 3 bit subnet ID (= up to 8 subnets)
                                                                                             BUT then max 30 host per subnet: no way to accommodate pc-net!!
          Giuseppe Bianchi                                                                           Giuseppe Bianchi
                                                                                                                                                               4
     Requirements for VLSM support (1)                                                                       Routing tables for previous example
        '                                                   !
                    "                                                    "                 … … …
                               !                                                           net mask route                     pc-net
                                                                                                                          192.168.1.0/25                                         A                      x-net-1
        '                                              !                                   … … …                         (0-127, 126 host)                                                         192.168.1.160/27
                    "                                                                                                    255.255.255.128                                                          (160-191, 30 host)
                                                                                                                                                          192.168.1.208/30
            (                                                                                                                                                  Link-1         192.168.1.217        255.255.255.224
                                                                                                                                                     B
                                                                                                                                                               Point2point links:   Link-3
                                                                                                                                                               255.255.255.252 192.168.1.216/30
                   New route advertise + mask (or prefix len):                                                                                            192.168.1.213
                   131.175.192.0     10000011.10101111.11000000.00000000                                                ws-net                             Link-2                                           x-net-2
                   255.255.240.0     11111111.11111111.11110000.00000000                                           192.168.1.128/27                   192.168.1.212/30                                 192.168.1.192/28
                   prefix /20                                                                                     (128-159, 30 host)                                                                  (192-207, 14 host)
                                                                                                                   255.255.255.224                        Router C table                               255.255.255.240
        Without this feature: manually compiled tables (!!! Human error!!!)                                                                                                     C
                                                                                                                                       192.168.1.128             /27 192.168.1.213
                                                                                                                                        192.168.1.0              /25 192.168.1.213
             VLSM bottomline: need to use more complex routing protocols                                                               192.168.1.208             /30 192.168.1.213
                           (e.g. OSPF) even for small org                                                                              192.168.1.192             /28  Direct fwd           192.168.1.0 network
                                                                                                                                       192.168.1.192             /28  Direct fwd
             Giuseppe Bianchi                                                                                                          192.168.1.212
                                                                                                                             Giuseppe Bianchi                    /30  Direct fwd
                                                                                                                                       192.168.1.216             /30  Direct fwd
              ; ,                                       !           7 !                7                                     ; ,                                       !             7 !         7
                                                 <<                                                                                                             <<
- -
                                  !                                                                                                               !
                   Substantial reduction of routing table sizes                                                                    Substantial reduction of routing table sizes
                   Multiple route aggregation                                                                                      Multiple route aggregation
64.2.1.0 /28
                                                                                                                                                                                             5
                                     Solution – final
                                                             È sufficiente uno /24, es: 64.2.1.0 /24
                                                                                                                                            Complete example 2
             network         mask          dest              Una soluzione possibile, con massima aggregazione        Acquistando uno spazio di indirizzi il piu’ piccolo possibile, da un provider che
            64.2.1.128        /25       64.2.1.129           dei route, è illustrata in figura (si assume che         gestisce lo spazio 64.2.0.0 /16,
            64.2.1.64         /26       64.2.1.65            il routing esterno alla rete avvenga tramite             -Si subnetti la rete illustrata in figura in modo da soddisfare alle capacità richieste
             64.2.1.0         /26       64.2.1.66            l’interfaccia remota 64.2.100.1)
  still                                                                                                               -Si assegnino indirizzi IP alle interfacce dei router
             0.0.0.0           /0       64.2.100.1
obscure                                                                                                               -Si mostri la routing table del router R
                                                                 Edificio A                                                               network    mask     dest
           Router R                  64.2.1.129                  110 hosts
                                    64.2.1.65                    64.2.1.128 /25
  64.2.100.1 …
                                                                                                Edificio D                                                                Edificio A
                               Edificio B                                                        11 hosts                                 Router R                         10 hosts
64.2.1.0 /28
                                      Solution - final
             network         mask          dest
                                                             E’ sufficiente uno /24, es: 64.2.1.0 /24
                                                             Una soluzione possibile, con massima aggregazione
                                                                                                                               Example:
                                                                                                                               Example: VLSM engineering
            64.2.1.128        /25       64.2.1.129           dei route, e’ illustrata in figura (si assume che
             64.2.1.0         /25       64.2.1.200           Il routing esterno alla rete avvenga tramite
            64.2.1.48         /28       64.2.1.49            l’interfaccia remota 64.2.100.1):
             0.0.0.0           /0       64.2.100.1                                                                             VLSM subnetting of class A 11.0.0.0
                                                                 Edificio A                                                                                                   11.1.0.0/24                    11.1.254.0/28
           Router R                  64.2.1.49                    10 hosts                                                                           11.0.0.0/16              11.1.1.0/24                    11.1.254.16/28
                                    64.2.1.129                   64.2.1.48 /28                                                                       11.1.0.0/16                                             11.1.254.32/28
  64.2.100.1 …                                                                                                                                                                11.1.254.0/24
                                                                                                Edificio D                                           11.2.0.0/16
                                                                                                 11 hosts                  11.0.0.0/8                                         11.1.255.0/24                  11.1.254.208/28
                            Edificio B
             64.2.1.128 /25 110 hosts                                                                                                                11.253.0.0/16                                           11.1.254.224/28
                                                                          64.2.1.66 64.2.1.22         64.2.1.16 /28
                                                                                                                                                     11.254.0.0/16               11.254.0.0/19               11.1.254.240/28
                                      64.2.1.200                 Edificio C
                                                                                           64.2.1.2                                                  11.255.0.0/16               11.254.32.0/19
                                                     64.2.1.77    55 hosts                                                                                                       11.254.64.0/19
                                                             64.2.1.64 /26                      Edificio E
                                                                                                                                                                                 11.254.192.0/19
                                                                                                 12 hosts
                                                                                                                                                                                 11.254.224.0/19
                                                                                            64.2.1.0 /28
                                                                                                                                                                                                    6
 Route aggregation with VLSM
  VLSM allows to hide detailed structure of routing
  information for one subnet group from other routers -
  reducing routing table Size
                                          11.1.0.0/16
                              11.0.0.0/16                    11.1.0.0/24
                     Router A 11.1.0.0/16   Router B
                                                             11.1.1.0/24
                                                                                                   CIDR
        11.0.0.0/8
                              11.253.0.0/16
                              11.254.0.0/16                  11.1.254.0/24           Classless Inter-
                                                                                               Inter-Domain Routing
                              11.255.0.0/16                  11.1.255.0/24
     Internet                                                                           RFC 1517 to 1520 (1993)
                                  11.254.0.0/16                11.1.254.0/24
                                 Router C                     Router C
                             11.254.32.0/19                 11.1.254.0/28
                             11.254.64.0/19                 11.1.254.16/28
                                                            11.1.254.32/28
                             11.254.192.0/19               11.1.254.224/28
                             11.254.224.0/19               11.1.254.240/28
     Giuseppe Bianchi                                                                 Giuseppe Bianchi
         An historical perspective
          N x class C? Class B?                                                     The 1992 Internet scenario
                                            130.11.0.7            213.2.96.0          (
                                       Net                                         In early years, Class B addresses given away!
                            R2       130.11.0.0       R3
                                                                                   Unefficient division into A, B, C classes
                                                                  213.2.97.0
                                                                                      byte-word: unwise choice (class C too little, class B too big)
                                                                                      The aftermath: much better, e.g. C=10 bits, B=14 bits
                                  R2 Routing Table
                                                                  213.2.98.0       Projections at the time: class B exhaustion by 1994/95
                                  dest       Next Hop
                              130.11.0.0 Direct fwd
                                   …              …               213.2.99.0
                              213.2.96.0     131.11.0.7
                              213.2.97.0     131.11.0.7          Corporate
                              213.2.98.0     131.11.0.7
                                                                                                                            $
                              213.2.99.0     131.11.0.7                                                                                            %          <
                                                                                                                            :                          ==
                                                                                                                                             7
             The 1992 Internet scenario                                                                              Multiple class C assignment
                                                                                                                                                                          Corporate Network
    -                                                                                                      11.0.0.32                   20.0.0.6 130.11.0.12 130.11.0.7
                                                                                                                                                                          213.2.96.8
                                                                                                                         20.0.0.5                                                      213.2.96.0
            Multiple class C allocation dramatic for routing tables
                 necessary because of Class B exhaustion                                                 Net           R1       Net           R2        Net          R3
                                                                                                        11.0.0.0               20.0.0.0               130.11.0.0
                 100.000 entries highly critical for performance                                                                                                                       213.2.97.0
                   » 2M class C: WAY OUT of the capabilities of routing sw & hw
                                                                                                                     R2 Routing Table                                                  213.2.98.0
                                                                                                        Destination Network        Next Hop                        213.2.99.5
                                                                                                                                                                                       213.2.99.0
                                                                                                               20.0.0.0                 Direct forward
                                                                                                              130.11.0.0                Direct forward
                                                     Projections at the time                                                                                        Default routes: suboptimal
                                                        End 1990: 2190 routes; end 1992: 8500 routes;          11.0.0.0                     20.0.0.5                traffic balancing
                                                        End 1995 projection: 70000 routes (critical);
                                                                                                              213.2.96.0                   130.11.0.7               Core routers: cannot have
                                                        End 1995 factual: 30000 routes thanks to                                                                    default routes (large tables)
                                                        classless routing                                     213.2.97.0                   130.11.0.7
                                                        Mid 1999: 50000 routes
                                                                                                                                                                    HW and SW limits on routing
                                                                                                              213.2.98.0                   130.11.0.7               table lookup time
                                                                                                                                                                    Routing table updates are
                                                                                                              213.2.99.0                   130.11.0.7               critical (large tables traveling
                                                                                                                                                                    among routers for updates)
                 Giuseppe Bianchi                                                                                   Giuseppe Bianchi
        Classless Inter-
                  Inter-Domain Routing                                                                                                CIDR model
                      CIDR                                                                                    Classless
        3                                                            %% 4
                                                                                                                 Completely eliminates traditional concepts of Class A, B and
                 ' 6 % 0 0> 70 01 70 03 70       2
                                                                                                                 C addresses
            !5             )                 +
                                                                                                              network prefix based
        6
                                                                                                                 routers do not make any assumption on the basis of the
                                                 !                                                               three leading bits
                                                                                                                 they require an explicit network prefix to determine dividing
             32 bits: unwise choice
                   nobody could expect such an Internet growth                                                   point between net_id and host_id
                   and Internet appliances will have a terrific impact                                           clearly, capability of advertise prefix must be supported by
             unwise address assignment in early days                                                             routing protocol (e.g. BGP4)
                   class B addresses with less than 100 hosts are common!!
             Projections (RFC 1752): address depletion between 2005                                           In essence: CIDR = VLSM applied to the
             and 2001                                                                                         WHOLE Internet!!
             Ultimate solution: IPv6 (128 bits address!)
                 Giuseppe Bianchi                                                                                   Giuseppe Bianchi
        Regardless the traditional class, all these addresses are similar!                                         Example: 4 class C addresses appear to networks outside as
        All address a network composed of as much as 4094 hosts                                                    a single network
Interpreting 200.7.128.0/20: a SINGLE NETWORK, contiguous block of 16 class C addr                                             Natural class C mask
          200.7.128.0        200.7.132.0   200.7.136.0       200.7.140.0
          200.7.129.0        200.7.133.0   200.7.137.0       200.7.141.0                                   1 1 1 1 1 1 1 1          1 1 1 1 1 1 1 1     1 1 1 1 1 1   00     0 0 0 0 0 0 0 0
          200.7.130.0        200.7.134.0   200.7.138.0       200.7.142.0
          200.7.131.0        200.7.135.0   200.7.139.0       200.7.143.0                                                    (Super) netmask: 255.255.252.0
                                                                                                                                                                         8
                                                                                                          Routing with CIDR
                Supernet Address
                                                                                                                                                        213.2.96.8
                                                                                         11.0.0.32     20.0.0.5       20.0.0.6 130.11.0.12 130.11.0.7
4 address-contiguous networks:                                                                                                                                       213.2.96.0
                                                                                       Net                       Net                  Net          R3
 213.2.96.0           11010101.00000010.01100000.00000000                             11.0.0.0       R1         20.0.0.0     R2     130.11.0.0
 213.2.97.0           11010101.00000010.01100001.00000000                                                                                                            213.2.97.0
                                                                                                                                                        9
                                                                                                                         Exception route
              Longest match forwarding                                                                        IPDEST: 195.0.20.2
                                                                                                    11000011.00000000.00001100.00000010
                                                                                                             ???                       194.0.0.0 /7 (254.0.0.0)
                IP packet                                                                                                       11000010.00000000. 00000000. 0
                                                                                                         NY                                                      PARIS
         Destination: 203.22.66.5                              Routing table
11001011 . 00010110 . 01000010 . 00000101                                                             ROUTER                                                    ROUTER
                                                     203.0.0.0 /11         Route 1
                                                                                          Three                      shorter (cheaper) path
                                                     203.20.0.0 /14 Route 2                                          for this organization...
                                                                                         matches                                                                European region
                                                    203.22.64.0 /20 Route 3                                                                                     194.0.0.0 - 195.255.255.255
                                                                                                                                                                10
                                                                                        IPv6
    Network Address Translator
                                                                             (IP next generation - IPng)
                                                                                                   IPng)
     “Inside” Network                               “Outside” Network
                                                                           The ultimate address space solution
                                 NAT                                          128 bit addresses
                   10.0.0.2                    192.69.1.1
10.0.0.2
                                                                Internet
                                                                              some other very important corrections and
                                                                             improvements to IPv4
10.0.0.3
                                                                                  although mostly designed to be as close as possible
Source Address
                                                                                 to IPv4
                              NAT Table
                   Inside Local    Inside Global                           Prices to pay:
                    IP Address      IP Address
                      10.0.0.2         192.69.1.1
                                                                             Double IP header size (40 bytes versus 20)
                      10.0.0.3         192.69.1.2
                                                                             Difficult and slow transitory from IPv4 to IPv6
Map external address with Internal ones (may be a subset)
       Giuseppe Bianchi                                                      Giuseppe Bianchi
11