OSI - Network Layer

4522 단어

OSI - Network Layer


 --------------
| Application  |  Network Process to Applications
 --------------
       |
 --------------
| Persentation | Data Representation
 --------------
       |
 --------------
| Session      | Interhost Communication
 --------------
       |
 --------------
| Tansport     | End-to-End Connections
 --------------
       |
 --------------
| Network      | Data Delivery
 --------------  
       |
 --------------
| Data Link    |
 --------------
       |
 --------------
| Physical     |
 --------------
       
We know that the second layer of OSI, the data link layer, uses MAC addresses for addressing, and MAC addresses are a flat addressing scheme. The reason why it is called a flat addressing scheme is because it does not have a hierarchical design, which brings some problems:

  • All devices are in the same broadcast domain;
  • It is difficult to locate the device;
  • Difficulty applying policies to devices;

  • Because of these problems, we need to divide our network. After the division, different strategies can be used for different networks, and the network can be managed hierarchically. With hierarchical management, it will be much easier for us to locate a host.
    Then the question arises, if to achieve it? Yes, it is the IP protocol.

    IP Address Classes


    We know that IP address is divided into two parts network part and host part. So how many bits do the network part and the host part occupy?
    Traditional IP address classification divides IP addresses into Class A, Class B, Class C, Class D, and Class E. Among them, class A, class B, and class C are used normally, class D is used for multicast, and class E is reserved for use.
         ---------      -----      -----      -----
    A  | 0******* | . | Host | . | Host | . | Host |
         ---------      -----      -----      -----
    0 ~ 126
    
    127 (01111111)  A , loopback testing , network 。
    
         ---------      --------      -----      -----
    B  | 10****** | . | NetWork | . | Host | . | Host |
         ---------      --------      -----      -----
    128 ~ 191
    
         ---------      --------      --------      -----
    C  | 110***** | . | NetWork | . | NetWork | . | Host |
         ---------      --------      --------      -----
    192 ~ 223    
         
    

    Reserved Address


    You must remember that when we calculate how many hosts a network has, we use 2n-2 to calculate how many hosts the network can hold. Why subtract 2?

  • Network Address

  • Where the host part is all 0 is the network address. For example, 192.168.1.0 This is a class C address, the last 8 bits are the host part, and the last 8 bits are all 0, indicating that 192.168.1.0 represents a network.

  • Broadcast Address

  • Any data sent to the broadcast address needs to be processed by all devices.
    The broadcast address is further divided into: direct broadcast and restricted broadcast
    For example, 172.16.0.0/16 The direct broadcast address for this network is �172.16.255.255 , while the restricted broadcast address is: 255.255.255.255 .
    direct broadcast
    A host part that is all 1 is a direct broadcast.
    Direct broadcasts can be forwarded by routing and sent to all hosts on the target network. For example, a host with an IP address of 192.168.2.1 can also send broadcasts to the network 192.168.1.0. Of course not all routers, fool routers block direct broadcasts by default.
    restricted broadcast
    Routers do not forward restricted broadcast packets, but all hosts on the same subnet receive restricted broadcast packets. The network field and host field of the IP address are all 1s, which is the restricted broadcast address 255.255.255.255

    Private IP Addresses





    Class
    Private Address Range




    A
    10.0.0.0 ~ 10.255.255.255


    B
    172.16.0.0 ~ 172.31.255.255


    C
    192.168.0.0 ~ 192.168.255.255



    Generally speaking, the private ip address is used in the internal network, and the public ip address is used in the external network. In this case, in order to be able to communicate at the egress, it is necessary to do address translation (NAT).

    좋은 웹페이지 즐겨찾기