"Computer network Fifth edition" Reading note four: Network layer

Source: Internet
Author: User

Fourth Chapter Network layer

1. Two services at the network layer : Virtual circuit Service (reliability guaranteed by the network) and datagram service (reliability guaranteed by the user host)

2. Internet Protocol

(1) Address Resolution Protocol ARP and Inverse Address Resolution Protocol (RARP): Under IP protocol, IP uses these two protocols to resolve to the physical address

(2) Internet Control Message Protocol (ICMP) and Internet Group Management Protocol (IGMP): On top of IP protocol, using IP protocol

Tips: Here are some of the relevant protocols for each layer: Application layer protocol: HTTP,FTP,SMTP; Transport Layer Protocol TCP,UDP

3. Intermediate equipment for each layer:

(1) Intermediate equipment used in the physical layer called Transponder (repeater)

(2) intermediate devices used in the data link layer called Bridges or bridge

(3) intermediary device used by network layer called Router (router)

(4) Intermediate devices used above the network layer called gateways (Gateway )

4.IP protocol : IP address = network number net_id+ host number host_id, expressed in dotted decimal (every eight bits converted to decimal).

4.1 IP Classification :

(1) Class A: 1-byte network number + 3-byte host number, network number up to 0, address range: 1.0.0.0~126.255.255.255, maximum number of hosts is 2^24-2=16777214.

(2) Class B: 2-byte network number + 2-byte host number, network number first two Bits 10, address range: 128.1.0.0~191.255.255.255, maximum number of hosts is 2^16-2=65534

(3) Class C: 3-byte network number + 1-byte host number, network number first three BITS 110, address range: 192.0.1.0~223.255.255.255, maximum number of hosts is 2^8-2=254

(4) Class D: Multicast address, 1110 start

(5) Class E: Reserved address, 1111 start

General non-use of the special Address: (Network number 0 for the network, the host number 0 for the host, all 1 for all hosts)

Network number Host number Source Address Use Destination Address Use meaning of the representative
0 0 OK Not This host on the network
0 host_id OK Not One of the hosts on this network host_id
All 1 All 1 Not OK Broadcast only on this network
net_id All 1 Not OK Broadcast to all hosts on the net_id
127 Any number of non-full 0 or full 1 OK OK Used as a local software loopback test

features of 4.2 IP

(1) The advantages of the hierarchical structure: the allocation of only the network number, the host number is assigned by the user unit; Routing tables are grouped by host number, reducing the amount of space the routing table occupies and the time it takes to find the routing table

(2) The connection network different IP is different, at the same time the host of multiple networks is called multi-attribute host. A router must connect at least two different networks (intranet and extranet), so a router should have at least two different IP addresses

(3) Several LANs connected with transponders or bridges are still a network because their network numbers are the same

(4) All networks assigned to network numbers are equal

4.3 IP address and Physical address

(1) The IP address is placed in the header of the IP datagram, and the MAC address is placed on the Mac frame header;

(2) using the IP address above the network layer and the network layer, using the MAC hardware address at the Data link layer and below ;

(3) Mac frames do not see the IP address, is packaged up.

4.4 Arp and RARP protocol

(1) ARP Workflow: A broadcast ARP request (need to get the hardware address of B), B received a request to send an ARP response to a unicast, at this time b the IP address of a and MAC address exists in the high-speed ARP cache for the next send , a receives B's response, and also writes B's IP address and MAC address mappings in its own ARP cache.

(2) high-speed ARP cache: The mapping address has a certain life cycle , more than directly discarded.

(3) ARP is a mapping problem that resolves the IP address and router address of hosts and routers on the same LAN . If the host you are looking for is not in the LAN, then you need to find the hardware address of a router located in the LAN through ARP, and then pass the packet data to the router, the router then transmits the packet to the next network.

4.5 format of IP datagrams

The composition of the IP datagram: header (20 bytes) + Data section

(1) Version number: version of IP protocol

(2) First length: Common header length is 20 bytes

(3) Differentiated services: This field is generally not used

(4) Total datagram length: The sum of the header and data, 16 bits, indicating a maximum length of 65535 bytes, due to the MTU limit, generally not more than 1500 bytes. In addition, the total length of the datagram does not refer to the total length of the datagram before the Shard, but the length of the header + data of each slice after the Shard.

(5) Identification: the identification field is generated by the counter, each resulting in a datagram to add 1, the datagram shard after the identity segment is also copied to the individual shards in order to reload the original datagram.

(6) Flag: Three-bit, the lowest bit is Mf,mf=1 representative also has the Shard, conversely does not have; the middle one is marked as df,df=1. No shards are allowed, whereas shards are allowed

(7) Slice offset: The relative position of the slice in the original group after the Shard. The unit is 8 bytes, the length of the Shard is 8 of its own multiples;

(9) Time-to-Live (TTL): The lifetime of datagrams in the network. Prevent the inability to deliver datagrams in the network without restrictions. On each router, the TTL subtracts the time the datagram consumes in the router, and the TTL is 0 to discard the report.

(10) Agreement: What is the agreement to carry the data? Common protocol fields: 1-icmp,2-igmp,6-tcp,8-egp,17-udp,41-ipv6, etc.

(11) The first Test and: Anti-code arithmetic operations, that is, the sender of the first test and 0, all the header and add to receive the end of the test and the receiver to determine the first and the inverse code is 0, 0 is reserved, not 0 is discarded. (Very good description of the process)

(12) Source Address and destination address: each accounted for 32 bits, IP address.

4.5 Forwarding Group : to a routing information (destination network address, next jump address)

(1) Extract the destination host's IP address D from the datagram to obtain the destination network address n

(2) If n is a network address directly connected to this router, it is delivered directly, otherwise indirect delivery, execution (3)

(3) If there is a specific host route in the routing table with destination D, the datagram is routed to the next-hop router of the routing table; otherwise, execution (4)

(4) If there is a route in the routing table to reach the network N, the datagram is routed to the next hop router indicated in the routing table, otherwise, the execution (5)

(5) If there is a default route in the routing table, the datagram is routed to the default route indicated in the routing table, otherwise, execution (6)

(6) Error reporting forwarding packet.

5. Dividing subnets

5.1 IP Address ={< network number >,< subnet number >,< host number, the number of bits borrowed from the host number as the subnet number subnet_id, from the two-level IP structure into a three-level IP structure.

Tips: Dividing subnets is purely a matter within a unit, and is still represented as a network.

5.2 Subnet Mask : Gets the network address of the subnet from the IP address

5.3 Packet forwarding using subnets (IP address and subnet mask = network address)

(1) Extract the IP address of the destination host from the datagram D

(2) The first judgment can be delivered directly. The network directly connected to the router check: With the subnet mask of each network and d, to see if the result matches the corresponding network address, if the match is delivered directly; otherwise indirect delivery, execution (3)

(3) If there is a specific host route in the routing table with destination D, the datagram is routed to the next-hop router of the routing table; otherwise, execution (4)

(4) Each row in the routing table (destination address, subnet mask, next hop address), with the subnet mask and D bitwise phase, get the network address N, if matching the destination network address of the line, then pass to the next hop address, otherwise, execute (5)

(5) If there is a default route in the routing table, the datagram is routed to the default route indicated in the routing table, otherwise, execution (6)

(6) Error reporting forwarding packet.

6. No classification addressing CIDR

(1) IP structure: IP address = {< network prefix >,< host number,}, using slash notation, 128.13.35.7/20, indicating the first 20 bits are network prefixes

(2) Consecutive IP addresses with the same network prefix form a CIDR address block

(3) Address mask: You can also continue to be called a subnet mask.

(4) When looking for a routing table, you may get more than one matching result. The longest prefix matching route should be selected from the matching results

For example: Destination addresses 206.0.71.130 and 206.0.68.0/22, and 206.0.71.126/25 can all match

At this point you need to select * * The longest prefix match **206.0.71.126/25 as the next hop address.

(5) The loop lookup of all possible prefixes is inefficient, and binary clues can be used to quickly find the longest prefix match

7. Internetwork Control Message Protocol ICMP(not a high-level protocol, it belongs to the IP layer protocol)

(1) Role: In order to more effectively forward IP datagrams and improve the chances of successful delivery

(2) ICMP messages are automatically sent when the IP data cannot be accessed, the IP router cannot forward packets at the current rate of transmission, etc.

(3) Message type: Error Reporting message and inquiry message

Among them, error reporting messages:

    • Destination Unreachable: Unable to deliver the datagram to the source point

    • SOURCE Point suppression: When a router or host drops data due to congestion, sending the message notifies the source to slow down the datagram sending rate

    • Time Exceeded: TTL will be 0, discarding data while sending the message

    • Parameter problem: Incorrect header field, discard data, send the message

    • Change routing: Let the host know the next time the datagram should be sent to another better router

Inquiry message:

    • echo Request and reply: The host sends the ECHO request message to the destination host, and the destination host sends a reply message to the source host to test whether the destination host station can reach and understand its status

    • Timestamp request and Answer: used for clock synchronization and measurement time.

(4) Application: Packet inter-network detection ping, used to test connectivity between two hosts, the use of ICMP echo request and response messages, ping is the application layer directly using the network layer ICMP example, not through the network layer TCP and UDP

8. Route Selection Protocol

8.1 Route Selection Protocol classification

(1) Internal network Management Protocol IGP: Routing protocols used within an autonomous system (as), such as RIP and OSPE protocols

(2) External Gateway Protocol EGP: At the boundary of an autonomous system, the protocol used to pass routing information to the next autonomous system. such as BGP-4

8.2 Internal Gateway protocol RIP: constantly updating the routing table, making routing from each route to each destination shortest.

(1) A distributed routing protocol based on distance vectors.

(2) "distance" in the agreement is also called "hop count", each pass a route plus +1

(3) Characteristics of the Agreement:

    • Exchange information only with neighboring routers

    • The information exchanged is all the information that is currently known to the router (the information includes the shortest distance I have to each network in this as, and the next hop router to each network).

    • Exchange routing information at regular intervals.

(4) Distance vector algorithm (destination network + distance + Next hop router)

A RIP message is sent to an adjacent route with an address of X, and all items of the message are modified (distance d+1, the next hop is changed to X), and each item is treated as follows:

    • If there is no destination network N in the source route, add the item to the routing table

    • If there is a destination network n, view the next hop router, if x, replace the routing table directly

    • If there is a destination network N, the next hop router is not X, then the distance is compared, if the small is updated, the reverse is discarded

8.3 Internal Gateway protocol OSPF

(1) using the Distributed Link State Protocol, Open Shortest Path First (Open Shortest path), using Dijkstra's Shortest path algorithm SPF

(2) Three points (different from RIP)

    • With flooding, routers send information to all neighboring routes through all the output ports

    • Link status of all routers adjacent to this router when sending information

    • Only if the link state changes, the router will again use the flooding method to send information (unlike RIP)

(3) Features:

    • A link state database is established, and the topological structure diagram of the whole network

    • Can update the database faster, the update process converges quickly

    • In order for OSPF to be used in a large-scale network, it divides an autonomous system into multiple regions, so that the range of exchange-state information using the flooding method is limited to every region, reducing the amount of traffic on the network

    • OSPF is sent directly with an IP datagram without UDP

    • OSPF can calculate different routes for different types of business

    • Load balancing between multipathing: allocating traffic on multiple paths with the same cost

    • OSPF supports variable-length subnetting and non-categorized addressing CIDR

(4) OSPF packet IP datagram

OSPF Five grouping types: Greetings (hello) groupings, database Description groupings, link State request groupings (link state requests), link status updates (link states update) groupings, Link state acknowledgment (link acknowledgment) grouping.

8.4 External Gateway Protocol BGP: try to find a better route that can reach the destination network rather than looking for an optimal route

(1) Route selection protocol using path vectors

(2) Each as requires a BGP spokesperson, these speakers Exchange routing information, build as connectivity graph, it is a tree structure, there is no loop

The built as connectivity graph is as follows:

composition of the 8.5 router : Divided into Routing and packet forwarding parts

(1) Packet routing: construct the routing table based on the previous routing protocol and regularly update and maintain the routing table to select packet routing

(2) packet forwarding part: Divided into switching structure, a set of input ports and a set of output ports

    • Switching structure: According to the forwarding post, the packet processing, the input port into the packet from a suitable output port forward. Three modes of exchange: via the memory, via the bus, through the interconnection network

    • Input port: Data Link Layer processing--network layer processing packet queuing--switching structure from line accept group to physical layer processing

    • Output port: Switch fabric, network layer processing, packet queuing, data link layer processing, physical layer processing, and send to route group

9.IP multicasting : using class-D IP

(1) The multicast address can only be used as the destination address, not as the source address

(2) Internet Group Management Protocol IGMP

Virtual Private network and network address translation Nat

(1) All destination routers in the Internet do not forward the data of the dedicated address at the destination address. Such as:

    • 10.0.0.0 to 10.255.255.255

    • 172.16.0.0 to 172.31.255.255

    • 192.168.0.0 to 192.168.255.255

(2) Using tunneling technology to encrypt internal data for virtual private VPN network

"Computer network Fifth edition" Reading note four: Network layer

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.