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

             IP
   -   ,   C      
   .

  11..   

           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>.


  22..  

       IP     
  ,        
  , .


             IP
  

          .


        IP  C -  

        A   .


  22..11..    

          

         
    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>.


  33..     IIPP 

        (sub-networking) ,
          IP .

  33..11..    IIPP   IInntteerrffaacceess --    hhoossttss!!

   ',       - 
   IP     hosts.   IP 
   interfaces     hosts.


   -   ?


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


      6  interfaces (   -
  router)   6 IP  -    interface  
      .  

  '       IP!


  ',     _h_o_s_t ___________ 
     IP.   ,    
   ___ ______ _I_P  ___ _____________ _i_n_t_e_r_f_a_c_e __ _____ ___ _h_o_s_t.
   (   )    Internet 
   interface     IP.


  33..22..    IIPP  ""  ""

    (IPv4)    IP,  
   4 (8 bit) bytes -    32 bits 
  .         
  (       ).  
   (    )   IP 
      '  ' ('dotted quad').  P
  



               192.168.1.24




     - 4 ()   
  (.) .


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


  ,    IP  host    
    host ,   'bits'   IP 
     host (... - interface  ).   
  bits   ID       
    hosts (interfaces)       
  '' ('class')  .

  33..33..     IIPP

      IP


       IP     8  bits
     (   )     ,
      24 bits (     )  
      host interfaces    .
        A     bit  
      byte   -       0
      127    .      128
      1   ,  '   
      33,554,430  interfaces.

     ,   0.0.0.0 (    default
     route)  127.0.0.0 (   - loop back network)
             
      .    126 __________ 
       .

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

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

  :



                        1 byte ()
                       A (1)  1 to 126
                       B (2)  128 to 191
                       C (3)  192 to 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


           
         ''  
  hosts.


  33..44..    ,,  iinntteerrffaaccee,, 
   ((bbrrooaaddccaasstt aaddddrreesssseess))

    IP      :-


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

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

       interface (   Ethernet   PPP
     interface   host, ,   .).
              host bits
          1 -    host bits  ,

              host bits  1 
         /.


         





























       ...

  ( byte        

  bytes     host)

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

       ...
  ( bytes        bytes 

     host)

          172.17.0.0      

          172.17.0.1     host    

          172.17.255.255    /   


      C...
  ( bytes       byte 
     host)


          192.168.3.0      C

          192.168.3.42     host    

          192.168.3.255    /   






     IP      
  

        C.


  33..55..     ((nneettwwoorrkk mmaasskk))

         (subnetwork mask).
  ,   '    .


            IP
  , ______,    IP     
  ,     (  ) -
   .


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


       : 255.0.0.0


       : 255.255.0.0

       C: 255.255.255.0


            
   :-

             IP
      (  ,      
     );

         IP  -   
           IP .


  44..     ??

          IP  
            IP  
         
    . ,    IP 
        .


       :       
  

          -  IP,

      -     IP .  
    -  -    

       .


  55..   ??

       -    
    IP -    sites   
    ,      hosts.


        ,
     IP computers    site   
     :     
          ( ) 
            (
  ).


      -:     IP
   A,   ,      
    (  )  .    
       .


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


     :-


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

          ,   
      .      ,
      ,,       
      ,   -    
              
        bandwidth ()


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

          ,
             (  
     ).


  66..        IIPP

           IP
   ,   ;      
  ,        :-


        (   
      -  .

      /     , 
                -
     ..    IP   
        .

           .

       interface      IP  
        .

       (routes)    
       (gateways),    
         .

      ,      !


       ,   
  -      C: 192.168.1.0


       254  interfaces (hosts),  
     (192.168.1.0)    
  (broadcast address) (192.168.1.255).


  66..11..     


          
        ,  
      .


            
    (,   (media converters)
  .).


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


  66..22..   

           
    '' IP .


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


  , ,   IP network   
  ,       
  -   ' '  interface
  (host);  4     
   interface (host) ...


   ,       4 IP
  :-

       IP  interfaces -    interface
               host 
      .

      .

      /.


             
     !    host  ,  
         .  , 
           
  -.


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


   ,          -
         
        
  , ,   !


  66..33..         

             
     IP  .


       - IP    
            'bits
  '     '1'    host bits  '0'.


  ,       IP,   
   :-

     A (8  bits ) : 255.0.0.0

     B (16 bits ): 255.255.0.0

     C (24 bits ): 255.255.255.0


        - ,   __________  
      bits      interfaces
       bits    network bits. ,
          , 
    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)
  ______________________________________________________________________




  ,        
     ,     bits  
        bit  host   
  .   ,     '  , 
   IP        ____  !
         ,    
      IP,       
      (      
       ,    
  ).


        ,  
         
  / -      IP    
    .  ,    IP    C
      _________  ( 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  hosts      .


  77..  

     / 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    
    )      
  '-'  .  Hosts     
    192.168.1.192   ________  
  '-' . ,    192.168.1.191
     /  '-' .


  ,    192.168.1.191   192  host 
    ,        
        .


          - 
        
     .


  77..11..     ((rroouuttiinngg ttaabblleess))

         Linux   router 
    .    interfaces    LANs 
     interface  Internet (    
   

  ).


      Linux     IP
        interface   
  . 

      interfaces  :

  ______________________________________________________________________
  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
  ______________________________________________________________________




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



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


  Robert Hart ,   1997.




























