Computer Networks (8th Edition) - Chapter 4 Network Layer

4.1 Several important concepts of the network layer

4.1.1 Two services provided by the network layer

If reliable communication is required between host (i.e. end system) processes, then the transport layer in the host is responsible (including error handling, flow control, etc.).

4.1.2 Two levels of the network layer

4.2 Internet Protocol IP

Figure 4-4 Internet Protocol IP and its supporting protocols

4.2.1 Virtual interconnection network

In general terms, some intermediate devices are used to connect networks to each other . Depending on the level of the intermediate device, there can be the following four different types of intermediate devices:

(1) The intermediate device used in the physical layer is called a repeater .

(2) The intermediate devices used in the data link layer are called bridges or switches , and switches .

(3) The intermediate device used in the network layer is called a router.

(4) The intermediate device used above the network layer is called a gateway. Using a gateway to connect two incompatible systems requires high-level protocol conversion.

When discussing network interconnection, we all refer to the use of routers for network interconnection and routing.

In the vocabulary of the Internet, each forwarding of a packet during transmission is called a " hop ."

4.2.2 IP address

There are three IP address addressing methods: classification, subnetting, and no classification.

1. IP address and its representation

For hosts or routers, IP addresses are 32-bit binary codes (IPv4).

An IP address is unique across the Internet .

2. Classified IP addresses

Figure 4-10 Classified IP addresses (a) and the proportion of each type of address (b)

But it should be noted that, first, the IP address with a network number of all 0s has a special purpose, it represents " this network " ; second, the network number of 127 (ie 01111111) is reserved as a local software loopback test (loopback test). For communication between host processes .

It should be pointed out here that due to the widespread use of unclassified IP addresses for routing in recent years (that is, any network bits, all host bits, and network host ID ), such classified addresses as Class A, Class B, and Class C have become history [RFC 1812].

3. Preparation of CIDR without classification

The full name of this preparation method is Classless Inter-Domain Routing ( CIDR) (pronounced CIDR is "sider") [RFC 4632], and its main points are as follows.

(1) Network prefix

(2) Address block

(3) Address mask

An address mask (often referred to as a mask, also called a subnet mask ) consists of a series of 1's followed by a series of 0's, where the number of 1's is the length of the network prefix.

The network address can be obtained by performing a bitwise AND operation on the binary IP address and address mask .

4. Characteristics of IP addresses

4.2.3 IP address and MAC address

The following points should be emphasized here:

(1) Only IP datagrams can be seen on the Internet where the IP layer is abstracted .

(2) Although there is the source station IP address in the IP datagram header, the router only forwards it based on the destination station's IP address .

(3) At the link layer of the LAN, only MAC frames can be seen .

(4) Although the MAC address systems of interconnected networks are different, the abstract Internet at the IP layer shields these very complex details of the lower layers. As long as we're talking at the network layer, we can study communication between hosts and hosts or routers using uniform, abstract IP addresses .

4.2.4 Address Resolution Protocol ARP

(a) Host A broadcasts and sends an ARP request packet (broadcast request)

(b) Host B sends an ARP response packet to A (unicast)

Figure 4-18 Working principle of Address Resolution Protocol ARP

However, IP addressing solves this complex problem . Hosts connected to the Internet only need to have one IP address each, and their previous communication is as simple and convenient as if they were connected to the same network. Even if ARP must be called multiple times to find the MAC address, this process is automatically performed by computer software. , invisible to the user.

4.2.5 IP datagram format

Figure 4-20 IP datagram format

As can be seen from Figure 4-20, an IP datagram consists of header and data. The length of the first part of the header is fixed , 20 bytes in total, and is required by all IP datagrams.

The following introduces the meaning of each field in the header.

1. Fields in the fixed part of the IP datagram header

(1) Version

(2) Head length

(3) Differentiated services

(4)Total length

The total length refers to the length of the header and data, in bytes. The total length field is 16 bits, so the maximum length of the datagram is  2^{16}-1=65535 bytes .

(5)Identification

(6) flag

Occupy 3 positions, but only two are currently meaningful.

  • The lowest bit in the flag field is MF (More Fragment). MF = 1 means that there will be "fragmented " datagrams later. MF = 0 indicates that this is the last of several datagram fragments.
  • The middle bit of the flag field is recorded as DF (Don't Fragment), which means " cannot be fragmented ". Fragmentation is only allowed when DF = 0.

(7) Chip offset

Occupying 13 positions. The slice offset points out: the relative position of a certain slice in the original packet after a longer packet is fragmented. This means that, except for the last datagram fragment, the length of each fragment must be an integer multiple of 8 bytes (64 bits).

(8) Survival time

(9) Agreement

(10) Header checksum

(11) Source address

(12) Destination address

2. The variable part of the IP datagram header

4.3 The process of forwarding packets at the IP layer

4.3.1 Endpoint-based forwarding

Every time a packet arrives at a router, the router looks up the forwarding table based on the end point (destination address) in the packet, and then knows which router the next hop should go to.

4.3.2 Longest prefix matching

4.3.3 Use binary clue tree to find forwarding table

4.4 Internet Control Message Protocol ICMP

4.4.1 Types of ICMP messages

4.4.2 ICMP application examples

4.5 IPv6

4.5.1 Basic headers of IPv6

The following six extension headers are defined in RFC 8200: (1) hop-by-hop options; (2) routing; (3) fragmentation; (4) authentication; (5) encapsulating security payload; (6) destination options .

4.5.2 IPv6 address

Generally speaking, the destination address of an IPv6 datagram can be one of the following three basic types of addresses:

(1) Unicast (unicast) Unicast is traditional point-to-point communication.

(2) Multicast (multicast) Multicast is point-to-multipoint communication, in which datagrams are sent to each of a group of computers.

(3) Anycast (anycast) This is a type added by IPv6 . The end point of anycast is a group of computers, but the datagram is only delivered to one of them, usually the closest one based on the routing algorithm.

4.5.3 Transition from IPv4 to IPv6

4.5.4 ICMPv6

4.6 Internet Routing Protocols

4.6.1 Several basic concepts about routing protocols

1. Ideal routing algorithm

The core of the routing protocol is the routing algorithm, that is, what algorithm is needed to obtain each item in the routing table. An ideal routing algorithm should have the following characteristics [BELL86]:

(1) The algorithm must be correct and complete .

(2) The algorithm should be computationally simple .

(3) The algorithm should be able to adapt to changes in traffic volume and network topology, that is to say, it must be adaptive .

(4) The algorithm should be stable .

(5) The algorithm should be fair .

(6) The algorithm should be optimal .

The so-called "best" can only be a more reasonable choice based on a specific requirement.

2. Hierarchical routing protocols

In this way, the Internet divides routing protocols into two major categories , namely:

(1) Interior Gateway Protocol IGP (Interior Gateway Protocol): There are many specific protocols, such as RIP and OSPF .

(2) External Gateway Protocol EGP (External Gateway Protocol): The currently used protocol is BGP-4.

4.6.2 Interior Gateway Protocol RIP

1. Working principle of protocol RIP

RIP (Routing Information Protocol) is the first widely used protocol among the interior gateway protocols IGP [RFC 1058] . Its Chinese translation is Routing Information Protocol. RIP is a distributed distance vector-based routing protocol and a standard protocol for the Internet. Its greatest advantage is simplicity.

RIP allows a path to contain up to 15 networks. Therefore, when "distance" is equal to 16, it is equivalent to unreachable. It can be seen that RIP is only suitable for small Internet .

The characteristics of the RIP protocol are:

(1) Only exchange information with neighboring routers.

(2) The information exchanged by the router is all the information currently known by the router, that is, its current routing table .

(3) Exchange routing information at fixed time intervals , for example, every 30 seconds.

2. Distance vector algorithm

3. Bad news travels slowly

4.6.3 Interior Gateway Protocol OSPF

1. Basic characteristics of the protocol OSPF

The main feature of OSPF is the use of link state protocol instead of a distance vector protocol like RIP. The characteristics of the protocol OSPF are :

(1) Send information to all routers in this autonomous system . The method used here is flooding , which is that the router sends information to all adjacent routers through all output ports.

(2) The information sent is the link status of all routers adjacent to this router, but this is only part of the information known by the router .

(3) When the link status changes or every period of time (such as 30 minutes), the router sends link status information to all routers using the flooding method .

2. Five grouping types of OSPF

4.6.4 Exterior Gateway Protocol BGP

1. Main features of protocol BGP

We know that interior gateway protocols (such as RIP or OSPF) mainly try to transmit datagrams from the source station to the destination station in an AS as efficiently as possible. There is no need to consider other policies within an AS. However, the environment in which BGP is used is different. This is mainly due to the following two reasons:

First, the scale of the Internet is too large, making routing selection between autonomous systems very difficult .

Second, routing selection between autonomous system ASs must consider relevant strategies .

Due to the above situation, the Border Gateway Protocol BGP can only strive to select a better route that can reach the destination network prefix (it cannot go around in circles), rather than calculating an optimal route . BGP uses a path vector routing protocol , which is very different from distance vector protocols (such as RIP) and link state protocols (such as OSPF).

2. BGP routing

3. Three different autonomous systems AS

4. BGP routing selection

5. Four types of BGP messages

4.6.5 Router composition

1. Structure of router

Figure 4-54 The structure of a typical router (numbers 1 to 3 in the figure indicate the components at the corresponding level)

As can be seen from Figure 4-54, the entire router structure can be divided into two parts: the routing part and the packet forwarding part .

2. Switch fabric

4.7 IP multicast

4.7.1 Basic concepts of IP multicast

4.7.2 Hardware multicast on LAN

4.7.3 Internet Group Management Protocol IGMP and Multicast Routing Protocol

4.8 Virtual Private Network VPN and Network Address Translation NAT

4.8.1 Virtual Private Network VPN (Security)

In order to solve the ambiguity problem that occurs when a local address used only internally overlaps with an IP address on the Internet, RFC 1918 specifies some private addresses (private addresses). Private addresses can only be used as local addresses and not as global addresses. All routers on the Internet will not forward datagrams whose destination address is a private address . In April 2013, RFC 6890 comprehensively provided all special-purpose IPv4 and IPv6 addresses, but the assignment of the three IPv4-specific address blocks has not changed, namely

(1) 10.0.0.0/8, that is, from 10.0.0.0 to 10.255.255.255.

(2) 172.16.0.0/12, that is, from 172.16.0.0 to 172.31.255.255.

(3) 192.168.0.0/16, that is, from 192.168.0.0 to 192.168.255.255.

Sometimes an organization's VPN requires the participation of some external organization (usually a partner). Such a VPN is called an extranet (extranet or extranet VPN, that is, extranet VPN).

4.8.2 Network Address Translation

A router equipped with NAT software is called a NAT router and has at least one valid external global IP address.

4.9 Multi-Protocol Label Switching MPLS

4.9.1 How MPLS works

4.9.2 Position and format of MPLS header

4.9.3 New generation of MPLS

4.10 Introduction to Software Defined Networking SDN

Key concepts in this chapter

exercise

4-15

Guess you like

Origin blog.csdn.net/qq_50564231/article/details/133517558