  IP Sub-Networking Mini-Howto
  Robert Hart, hartr@interweft.com.au
  v1.0, 31  1997

            
   IP -   ,   C      
   .

  [1m1.   [0m

           GNU Public License
  (GPL).


           
  InterWeft (, ).


            InterWeft
  WWW site  InterWeft IT Consultants <http://www.interweft.com.au/>
     The Linux Documentation Project
  <http://sunsite.unc.edu/LDP>.


  [1m2.  [0m

       IP     
  ,        
  , .


             IP
           .


        IP  C -   
       A   .


  [1m2.1.    [0m

           
          
   IP.        :


    The Linux Network Administrators Guide
     <http://sunsite.unc.edu/LDP/LDP/nag/nag.html>.

    The Linux System Administration Guide
     <http://linuxwww.db.erau.edu/SAG/>.

    TCP/IP Network Administration  Craig Hunt,  O'Reilly and
     Associates <http://www.ora.com/catalog/tcp/noframes.html>.


  [1m3.      IP[0m

        (sub-networking) ,
           IP.


  [1m3.1.    IP   interface -    host![0m

   ',       - 
   IP [1m [22m  host.   IP  
  interface     host.


   -   ?


    (   )     IP 
     interface  (     IP 
  ),          . 
           ( 
  ) interface  -  interface     
   IP.


      6  interface (   -
  router)   6  IP-    interface   
     .   '    
     IP!


  ' ,     [4mhost[24m [4m[24m 
     IP.   ,    
   [4m[24m [4m[24m [4mIP[24m  [4m[24m [4m[24m [4minterface[24m [4m[24m [4m[24m [4m[24m [4mhost[24m.
   (   )    Internet  
  interface     IP.


  [1m3.2.    IP  "  "[0m

    (IPv4)    IP,  
   4 byte (1 byte=8 bit) -    32 bit 
  .         
  (       ).  
   (    )   IP 
      '  ' ('dotted quad').  P
  



               192.168.1.24




     - 4 ()   
  (.) .


       4      
  byte  8 bit,     4      0
   255 ( 256   - ,  0   
   ).


  ,    IP  host    
    host ,   'bit'   IP 
     host (... - interface  ).   
  bit    ID      
     host (interface)      
   '' ('class')  .


  [1m3.3.     IP[0m

      IP

       IP     8  bit
     (   )     ,
      24 bit (     )  
      host interface    .
        A [1m [22m   bit  
      byte   -       0
      127    .      128
      1   ,     
      33,554,430  interface.

     ,   0.0.0.0 (    default
     route)  127.0.0.0 (   - loop back network)
             
      .    126 [4m[24m 
       .

       IP      16 bit
     (   )     ,
      16 bit (   )   
     host interface.        
     2 bit   byte 1 0.   14 bit  
             32767 
       . '   2     128
      191      ,     
      32,766  interface.

       IP  C   24  bit
     (   bytes)     ,
      8 bit (  byte)    host
     interface.    C     
      3 bit   1 1 0      192 
     255       .  
     4,194,303    IP  C,   
      254 interface. (   C     byte
       223       ).

  :



                        1 byte ()
                       A (1)  1  126
                       B (2)  128  191
                       C (3)  192  254





          '
  '  -      IP  
     Internet,    :


       
     10.0.0.0

    16   B
     172.16.0.0 - 172.31.0.0

    256   C
     192.168.0.0 - 192.168.255.0


           
         ''  
  host.


  [1m3.4.    ,  interface, [0m
  [1m (broadcast addresses)[0m

    IP      :


        IP (    IP  
           -   ..  
          Ethernet).     
        interface (host) bit     0 (
           -   );

       / (broadcast)   IP
     (      '',  , 
           IP).    
          interface (host) bit   
     1 (       - ,   ).

       interface (   Ethernet   PPP
     interface   host, ,   .).
              host bit
     [1m [22m    1 -    host bit  , 
             host bit  1 
         /.


         



            ...
       ( byte        
       byte     host)

               10.0.0.0   ,       host
                       bit   ,  0
               10.0.1.0     host    
               10.255.255.255.255    / (broadcast)   
                          host bit     1

            ...
       ( byte        byte 
          host)

               172.17.0.0      
               172.17.0.1     host    
               172.17.255.255    /   

           C...
       ( byte        byte 
          host)

               192.168.3.0      C
               192.168.3.42     host    
               192.168.3.255    /   





       IP    
         C.

  [1m3.5.     (network mask)[0m

         (subnetwork mask).
  ,        .


            
  IP, [4m[24m,     IP,     , 
     (  ) -  .


     (-)     bit   
   '1'    host bit '0'.     
         :


       : 255.0.0.0

       : 255.255.0.0

       C: 255.255.255.0


            
   :

          [1m [22m [1m [22m
     IP (  ,      
     );

       [1m [22m  IP -   
            IP.


  [1m4.     ;[0m

            IP
   [1m [22m         IP 
         
    . ,    IP 
        .


       [1m[22m:       
           -
   IP,     -     
  IP.     -  -   [1m [22m
       .


  [1m5.   ;[0m

       -    
    IP -    site   
    ,      host.


        ,
     IP computer    site    
    :       
        ( )    
         ( ).


      -:     IP
   A,   ,      
    (  )  .    
       .


      ,   - 
      . ,
      Ethernet, Token Ring, FDDI, ATM .  
    -  '   !


     :-

        site     
     ( )         
     ,   .   -  
       ,    IP,  
        IP.
             ISPs, 
        ,     
      ,   IP.

          ,   
      .      ,
      ,       
      ,   -    
              
        bandwidth ()

           
             - 
                ""
     .  -       
         /    
         (R & D) (     
          )!

          ,
             (  
     ).


  [1m6.        IP[0m

          
   IP ,   ;      
  ,        :-


        (   
      -  .

      /     , 
                -
     ..    IP   
        .

           .

       interface       IP 
        .

       (routes)    
       (gateways),    
         .


      ,      !


       ,   
  -      C: 192.168.1.0


       254  interface (host),  
     (192.168.1.0)    
  (broadcast address) (192.168.1.255).


  [1m6.1.     [0m


          
        ,  
      .


            
    (,   (media converters)
  .).


          
  .        
  /      .
          Usenet news
  groups (  comp.os.linux.networking).


  [1m6.2.   [0m

           
    ''  IP.


     IP       
   interface (host)-       IP 
    /.  ,  
     ,    IP  
   -         
          IP 
  .


  , ,   IP    ,
   [1m [22m   [1m [22m -
    ' '  interface (host);
   4   [1m [22m  
  interface (host) ...


   ,       4 
  IP:

       IP  interface -    interface 
              host 
      .

      .

      /.


             
     !    host  ,  
         .  , 
           
  -.


  ,       IP ,  
   2^n ( n        bit  
   IP )   .


   ,          -
    [1m [22m    
        
  ,     !


  [1m6.3.         [0m

           [1m [22m 
     IP  .


       -   IP  
            'bit
  '     '1'    host bit  '0'.


  ,       IP,   
   :

     A (8  bit ): 255.0.0.0

     B (16 bit ): 255.255.0.0

     C (24 bit ): 255.255.255.0


        - ,   [4m[24m  
      bit      interface [1m[0m
      bit    network bit. ,  
        ,   
  host bit    bit     
  () host bit  '1'.


      C,        
  
  11111111.11111111.11111111.10000000
   255.255.255.128


         C 192.168.1.0,  
      -  :-











  ______________________________________________________________________
  No of      No of
  subnets    Hosts/net    netmask
  2            126        255.255.255.128 (11111111.11111111.11111111.10000000)
  4             62        255.255.255.192 (11111111.11111111.11111111.11000000)
  8             30        255.255.255.224 (11111111.11111111.11111111.11100000)
  16            14        255.255.255.240 (11111111.11111111.11111111.11110000)
  32             6        255.255.255.248 (11111111.11111111.11111111.11111000)
  64             2        255.255.255.252 (11111111.11111111.11111111.11111100)
  ______________________________________________________________________




  ,         
    ,     bit   
       bit  host    .
   ,     '  ,   IP 
        [4m[24m  !   
      ,      
     IP,       
      (      
       ,    
  ).


        ,  
         
  / -      IP    
    .  ,      IP  C
      [4m[24m  ( host) :


  ______________________________________________________________________
  Netmask         Subnets Network B'cast  MinIP   MaxIP   Hosts  Total Hosts
  --------------------------------------------------------------------------
      128            2       0     127       1     126    126
                           128     255     129     254    126     252

      192            4       0      63       1      62     62
                            64     127      65     126     62
                           128     191     129     190     62
                           192     255     193     254     62     248

      224            8       0      31       1      30     30
                            32      63      33      62     30
                            64      95      65      94     30
                            96     127      97     126     30
                           128     159     129     158     30
                           160     191     161     190     30
                           192     223     193     222     30
                           224     255     225     254     30     240
  ______________________________________________________________________




     ,       
    ,         .
   ' '  -   ,  
         host ,  
     .


     ,       
  IP  host      .
  [1m7.  [0m

     / Linux      
     ( ),  
      IP (IP Forwarding)   .
   


  ______________________________________________________________________
          cat /proc/ksyms | grep ip_forward
  ______________________________________________________________________




        ...

  ______________________________________________________________________
  00141364 ip_forward_Rf71ac834
  ______________________________________________________________________




   ,       IP (IP-Forwarding)
          
    .


     ,      
    C     192.168.1.0  4
   (   62  interface/host 
  IP).  ,        
    ,    .


    :-

  ______________________________________________________________________
  Network         Broadcast       Netmask                 Hosts
  192.168.1.0     192.168.1.63    255.255.255.192         62
  192.168.1.64    192.168.1.127   255.255.255.192         62
  182.168.1.128   192.168.1.255   255.255.255.126         124 ( )
  ______________________________________________________________________




  :         124
     ( 126    
    )      
  '-'  .  Host     
    192.168.1.192   [4m[24m  
  '-' . ,    192.168.1.191
     /  '-' .


  ,    192.168.1.191   192  host 
    ,        
        .


          - 
       [1m [22m
     .

  [1m7.1.     (routing tables)[0m

         Linux   router 
    .    interface    LANs 
     interface  Internet (    
    ).


      Linux    
   IP      interface   
  .      interface :


  ______________________________________________________________________
  Interface       IP Address      Netmask
  eth0            192.168.1.1     255.255.255.192
  eth1            192.168.1.65    255.255.255.192
  eth2            192.168.1.129   255.255.255.128
  ______________________________________________________________________




        :


  ______________________________________________________________________
  Destination     Gateway         Genmask         Interface
  192.168.1.0     0.0.0.0         255.255.255.192 eth0
  192.168.1.64    0.0.0.0         255.255.255.192 eth1
  192.168.1.128   0.0.0.0         255.255.255.128 eth2
  ______________________________________________________________________




   '   ,  host     
    IP    (   
  ).  host    Linux PC    
  / (gateway/router),    IP 
  interface  Linux '   .



   , , ,    
     HOWTO,  email    :
  voulariba@hellug.gr     : evris@hellug.gr 
   : ep@rocketmail.com


  Robert Hart ,   1997.















