Computer network 4. Network Layer and IP protocol

Source: Internet
Author: User
Tags icann

Each host and router in the network has a network layer, and the router does not have a layer above the network layer. The network layer is the most complex layer in the protocol stack.

Forward forwarding: when a group reaches the input link of a vro, The vro moves the group to the appropriate output link.
Routing routing: when a group flows from the sender to the receiver, the network layer must determine the routing or path used by these groups. The algorithm used to calculate these paths is called routing algorithm.
Forwarding refers to the local action of the router to move the group from the input Link interface to the appropriate output Link Interface. The process that determines the network range of the end-to-end path when the routing group is from the source to the destination.
Each router has a forwarding table. The vro detects the value of a field in the first part of the group, queries the value in the forwarding table index, and forwards the value to the group. The Forwarding Table query result is the Link Interface of the vro to be forwarded by the Group. The detection header field is the destination address of the group or the indication of the connection to the group.
The route forwarding table settings are generally determined by the routing algorithm. The routing algorithm may be centralized, that is, the algorithm is executed at a central point and then the routing information is downloaded from each vro. It may also be distributed, that is, each part of the routing algorithm runs on each vro. All routers receive routing protocol packets to configure forwarding tables. You can manually set all forwarding tables without routing protocols. However, this is impractical, error-prone, and the forwarding table has poor results.
The group switches are divided into link-layer switches and router routers. The link layer switch forwards data based on the value of the header field in the frame transmitted by the link layer, while the router forwards data based on the value of the header field in the network layer datagram.
In addition to forwarding and routing, the network layer also establishes connection setup. From the source to the destination, shake hands with each other along the selected path to establish the status between the connections from the source to the destination before the network layer data group begins to flow.
Network Service Model: defines the end-to-end transport characteristics of the group between the sending end system and the receiving end system between the edge and the other edge of the network.
The transport layer service provided by the network layer to the sending host:
Ensure delivery: Make sure that the Group will eventually reach its destination.
Guaranteed delivery with a maximum latency: ensure that the group is delivered within the upper limit of the Host-to-host latency.
A service that provides a stream to a group between a given source and destination:
Ordered Group delivery: ensure that the group arrives at the destination in the sent order.
Minimum bandwidth: as long as the sending host transmits bits at a rate lower than a specific bit rate, the group will deliver the packets on time.
Ensure maximum latency jitter guaranteed maximum jitter: Make sure that the time between sending two successive groups is equal to the time between receiving them at the destination or the time interval does not exceed a fixed value.
Security Service: the source host's network layer can encrypt all the datagram loads sent to the target host using secret session keys only known to the source and target hosts. The network layer of the target host is responsible for decrypting the load.
The network layer of the Internet provides a single network service, which is called the Best Effort Service best-effort service. The timing between groups is not guaranteed, and the order in which groups receive messages cannot be guaranteed in order, delivery cannot be guaranteed for the Transfer Group.
In addition to the best-effort service model in the Internet, there are two types of services: constant bit rate and Available Bit Rate in the ATM network architecture:
Constant bit rate cbr atm Network Service: Suitable for carrying real-time and constant bit rate audio and video traffic.
Variable Bit Rate Available Bit Rate abr atm network service. It may be better to provide better services than what you can do. The ABR may lose cells, but the cells cannot be re-ordered or ordered. The minimum cell transmission rate (MCR) can be guaranteed with congestion indication.


Virtual circuit and datagram network:
The network layer is similar to the transport layer, and there are no connection services or connected services. Important differences between the network layer and Transport Layer in connection orientation: 1. at the network layer, these services are provided to the transport layer host-to-host services, while at the transport layer, these services are provided to the application layer process-to-process services. 2. In the computer network architecture, only one of the services is provided at the network layer. The network that provides the Connection Service is called the virtual circuit virtual-circuit network, and the computer network that provides the Connection Service is called the data packet network. 3. The connection-oriented service established at the transport layer is the connection between two end systems. The connection implemented at the network layer is also implemented in the vro at the core of the network, in addition to the end system.


Virtual circuit network: the Internet is a datagram network, while other network architecture ATM and Frame Relay are both virtual circuit networks.
The composition of a virtual circuit: 1. The path between the source and the destination, that is, a series of links and routers. 2. VC number, which is a number along each link of the path. 3. Forward table entries in each vro along the path.
A virtual circuit group must carry a VC number in its header. Because the VC number of a virtual circuit may be different on each link, use a new VC number to replace the VC number in the group. The VC number is obtained from the forwarding table. When a virtual circuit is created across a vro, a new item is added to the forwarding table. When the virtual circuit is terminated, the items in the forwarding table of each vro along the path are deleted.
The reason for keeping different VC numbers for each link in the virtual circuit: replacing the number by link can reduce the length of the VC field in the group header. By making each link in the virtual circuit have different VC numbers, simplifies the establishment of virtual circuits.
In a virtual circuit, the router must maintain the connection state information for the connection in progress. The connection items are stored in the forwarding table when they are created.
Three phases in a virtual circuit: 1. Establish a virtual circuit: connect the transport layer to the network layer, specify the receiver address, and wait for the Network to establish a virtual circuit. The Network Layer determines the path, determines the VC Number of the link, adds one in the forwarding table of each router, and can reserve resources such as bandwidth on the virtual circuit path. 2. Data Transmission: The group flows along the virtual circuit. 3. virtual circuit removal: When the receiver or sender notifies the network layer to terminate the virtual circuit, it notifies the other end and updates the forwarding table in each router.
The terminal system sends packets to the network indicating the startup and termination of the virtual circuit, and the packets transmitted between routers to establish the virtual circuit are called signaling messages. The protocol used to exchange these packets is called the signaling protocol.


Datagram Network: In a datagram network, when each end system sends a group, it adds the address of the destination end system to the group, and then pushes the group into the network. In the network, each vro uses the destination address of the Group to forward the group. Each vro has a forwarding table that maps the destination address to the Link interface, and then searches for the output Link Interface Based on the address for forwarding.
The forwarding table sets the corresponding Link Interface Based on the destination address range. The range of destination addresses in the forwarding table is a prefix match, that is, the forwarding table stores the prefix of a certain address, and then uses the destination address to match the prefix, use the corresponding Link interface to forward the group. The longest prefix matching rule is used in the vro. When multiple matches match, find the longest match in the forwarding table and use its Link interface to forward the group. If one of the forwarding table's 10001000 10001000 link interfaces is 0, the other is 10001000 10001000 10001000 Link interface is 1, and the other is "other" and the Link interface is 2, when the address is 10001000 10001000 10001000 10001000, Link Interface 1 is used to forward the group.
In a datagram network, the forwarding table is modified by the routing algorithm. The forwarding table is updated every 1-5 minutes.


The concept of a virtual circuit comes from a circuit switching network. The circuit switching network is much more complex than a group switching network, because the telephone network is connected to some low-end devices, these devices can only receive and send data, so most of the work needs to be done at the network layer. The Group switching network is designed for end systems such as computers, and such end systems can achieve many functions at a higher level, which reduces the work at the network layer: internet service models that provide minimum service guarantee make it easier to connect networks using various link layer technologies. New protocols can be implemented on end system computers located on the edge of the network.




Router Working principle:
A vro consists of four components:
Input Port input ports: run the physical layer function of connecting an input link to the vro. You also need to perform the link layer function that interacts with the link layer function located at the far end of the link. It also needs to complete the search and forwarding function, so that the groups forwarded to the vro switching structure can display the appropriate output port. Control groups (for example, groups with routing protocol information) are forwarded from the input port to the selector. Multiple ports in a vro are often concentrated on a line card in the vro.
Switching Fabric: connects the router's input interface to its output port. The switching structure is completely inclusive of contained in the vro, that is, it is the network in the vro.
Output port: stores the groups that are forwarded to the switch structure and transmits these groups to the output link. The output port performs the function in the opposite order of the input port. The link layer is used before the physical layer. When a link is bidirectional, the output window and input window connected to the link appear on the same line card.
Routing processor: runs the routing protocol, maintains the routing information and forwarding table, and implements the network management function in the router.


Input Port: In the vro, It is the output port in the input port to find the forwarding table and determine the forwarding. The forwarding table is copied to each input port while being processed by the selector and updated. Therefore, the group can directly make forwarding decisions on the input port without calling the central selector. This distributed decentralized forwarding method is more efficient. When a workstation or server is used as a router, its input/output port is its network interface card, and its route processor is its CPU, but its input port cannot be used for routing, the Group is directly sent to the central selector, and then the processor is used to perform forwarding search and forward. The router search speed is fast enough, and the processing speed should reach line speed, that is, the time needed to perform a search should be less than the time required to receive a group from the input port. Store the forwarding table items in a tree structure. Each level of the tree corresponds to a bit in the target address. 0 indicates the left subtree and 1 indicates the right subtree. Start from the root node and perform a 2-point search for the address. However, this method is not fast enough because the memory is accessed every time you search for it. Therefore, a higher-speed algorithm should be used.
The content addressable memory Content Addressable momery cam allows a 32-bit IP address to be submitted to Cam to return the content of the forwarding table corresponding to the address.
Once the output port of the group is found, the group is forwarded to the switch structure. When a group enters the switching structure, it is temporarily blocked because another group is currently using this structure. The blocking group will be queued at the input interface, waiting for scheduling.


Exchange Structure: The exchange structure has three types of exchange technologies:
1. Memory-switched switching via Memory: the earliest and simplest router is a computer, and its input and output ports are all directly controlled by the CPU. The CPU copies the incoming group to the processor memory, extracts the destination address, finds the appropriate output port in the forwarding table, and copies the group to the cache of the output port. If the memory bandwidth can be written into or read from Group B per second, the total forwarding throughput must be less than B/2, divide by 2 because the two operations, read from the input port to the CPU and then copy from the CPU to the output port, are not synchronized, and are less than because of computing time consumption. Many modern routers also use memory swap, but unlike computer routers, the destination address search and the Group are stored in the appropriate location by the processor on the input line card.
2. One bus switch: the input port directly transmits the group to the output port through a shared bus without interference from the selector. The inbound and outbound memory of the memory switching group also spans the system bus. Each group must span a single bus, and the switching bandwidth is limited by the bus speed.
3. One way to overcome the bus bandwidth limit is to use a complex interconnected network. A horizontal and horizontal Crossbar Switch is an interconnected network composed of 2n bus. It connects N input ports to N output ports. The Group traverses the horizontal bus connected to the input port until the intersection of the horizontal bus and the vertical bus connected to the desired output port. If it is blocked, the system returns the input port queuing.


Queuing: when the number of queues in the vro increases, the cache space is exhausted, and packet loss occurs. The location of group loss (the input port or output port) depends on the traffic load, the relative rate of the switching structure, and the line rate. The switching structure speed is the speed at which the switching structure moves the group from the input port to the output port. When the rate of the switching structure is at least N times the rate of the input line, no queuing occurs at the input interface. N is the number of input ports, that is, all ports are grouped at the maximum rate, but the switching structure can still transmit all input. The queuing of input ports is that the switching structure rate is less than the possible input rate. However, the output ports are different. When the switching structure rate is greater than the output link rate, queuing may be required because these traffic may want to go to the same output link.
An empirical method for calculating the cache length in a vro: the cache volume B equals to the average round-trip delay RTT multiplied by the link capacity C. This is a relatively small number of TCP streams. When a large number of TCP streams (n) pass through a link, the cache volume is B = RTT * C/√ n.
The queuing of the output port. A packet scheduler program of the output port must select one of these queuing groups for transmission. There are multiple selection strategies: FCFS scheduling and Weighted Fair Queuing wfq. The wfq rule is a fair shared output link between different end-to-end connections with queues waiting for transmission.
If too many input ports are queued, the Group to be dropped will be discarded, namely, tail drop-tail, or one or more queued groups will be deleted. In some cases, the cache is discarded before it is filled up to provide a congestion signal to the sender. These policies are called the AQM algorithm for active queue management. Random Early Detection RED is a widely used AQM algorithm that maintains a weighted average value for the length of the output queue. If the average queue length is smaller than the minimum threshold value min, when a group arrives, it is accepted as a queue. Conversely, if the queue is full or exceeds the max threshold value, it is marked or discarded. If the average queue length is in (Min, max), the Group is marked or discarded with a certain probability.
However, when the two groups at the front end of the input queue are sent to the same output queue, one of the groups is blocked and must wait in the input queue, because the exchange structure can only send one group to a specified output port at a time. We have previously considered a period of time. In this case, in an instant, two groups cannot be transferred to an output port at the same time by the exchange structure.
Line front-end head-of-the-line HOL blocking: When two groups at the front end of the input queue are sent to the same output port at a time point, one group must wait, even if the group that waits for the group has no competition with the other group, the group cannot be transmitted because it is blocked by the frontend Group of the queue.




IP Internet Protocol:
Currently, two versions of IP are in use: IP protocol version 4, IPv4, IP protocol version 6, and IPv6. The network layer of the Internet has three main parts: IP protocol, routing component: determines the path of the datagram flowing from the source to the destination, which consists of forwarding table and routing protocol. Facility for reporting errors in data packets and responding to certain network-layer information requests. The network layer error and information reporting protocol of the Internet, that is, the Internet Control Packet protocol ICMP.


Datagram format: consider the format of IPv4 datagram datasync. 32 bits are also used as a word in the datagram. The data stored in sequence is:
Version: the version number of 4 bits. IPv4 is used here.
Header Length: the header of an IPv4 datagram can contain some Optional options. Therefore, four bits are required to record the length of the header. However, most data packets do not contain optional values. Generally, they have a header length of 20 bytes. However, it is clear that the four bits should store the number of header words.
Service type: the service type TOS occupies 8 bits to distinguish different types of data packets. Such as real-time datagram and non-real-time traffic (such as FTP) are differentiated.
Datagram length: the length of the field is 16 bits, and the total length of the IP datagram is stored. The first part is added with data, which is recorded in bytes. The maximum value is 65535 bytes. However, the number of data packets generally exceeds 1500 bytes,
Identifier 16 bits, flags 3 bits, and fragmentation offset 13 BITs are associated with IP fragmentation. Partitions on a vroipv6 are not allowed on IPv6.
Lifetime time-to-live TTL: the lifetime field of 8 bits, used to ensure that the datagram will not always loop in the network. Every time a datagram passes through a vro, this field is reduced by 1. If the TTL field is reduced to 0, the datagram is discarded.
Protocol: the eight bits store the transport layer protocol, which specifies the Transport Layer Protocol to which the data part of the datagram should be paid. Here, the Protocol number is used to bind the network layer with the transport layer, just as the port number in the transport layer packet segment binds the transport layer with the application layer.
Header test: the header test of 16 bits, such as the header test in the datagram, for calculation. The router checks and detects the header of each received data packet. If an error occurs, the data packet is discarded. Note: After the TTL field is changed, the router must re-calculate and verify the data and place it in the original place. Here is the first check, that is, the IP address only checks and computes its own header, while the TCP port checks the entire packet segment. Second, TCP/UDP and IP are not necessarily in the same protocol stack. TCP can run on different protocols, such as ATM, while IP can also carry data transmitted to other transport layer protocols.
Source and Destination IP addresses: 32 bits each. When the source host generates a data report, it inserts an IP address in the source IP field and the destination IP address in the destination IP field. The source host uses DNS to find the destination address.
Option options: the option field allows the IP header to be expanded. The existence of the header changes the length of the datagram header, and the data field cannot be pre-determined from where it starts. The added processing options can reduce the Router speed. The existence of the option makes the router less efficient, so the IP option is not used in IPv6.
Data (payloda): The data field in the IP datagram generally contains the transport layer packet segment (TCP or UDP) to be delivered to the destination. It can also carry other types of data, for example, an ICMP packet segment.


Datagram fragment: an Ethernet frame can carry up to 1500 bytes of data. The maximum data volume that a link layer frame can carry is called the maximum transmission unit MTU. The Link Layer Protocol MTU strictly limits the length of IP datagram. Each link from the sender to the destination path may use different link layer protocols, and each protocol may have different MTU. Sharding is required to split the data in the IP datagram into two or more smaller data packets, and encapsulate these smaller IP data packets using separate link layer frames, then, these frames are sent to the output link. These smaller data packets are called fragment. IPv4 designers believe that re-assembly of a piece during transmission between routers will seriously affect the performance of the router. to adhere to the principle of keeping the network kernel simple, reassemble the data packets in the end system. When the terminal system receives some column data reports from the same source, it is necessary to determine whether some of these data reports are the original large piece of data. If you confirm that the data is a piece, it further determines when to receive the last piece and how to splice the piece into the initial datagram.
To allow the target host to execute these re-Assembly tasks, use the identifier, flag, and segment displacement fields in the IP datagram to record relevant information. When a data report is created for the source host, add the source address, destination address, and ID number to it. Add 1 to the ID number of each new datagram. When a vro Splits a data packet, it attaches the source address, destination address, and ID number of the initial data to each data packet, and sets the flag bit of the last data packet to 0, the flag bit of other slices is 1, and the specified part should be placed in the initial datagram position in the offset field. The number of payloads except the last one should be a multiple of 8 bytes, And the offset value is in 8 bytes. The offset value is the start position of the payload in the datagram.
For example, a 4000-byte datagram with a header of 20 bytes and a payload of 3980 bytes is divided into three parts to be forwarded to a 1500-byte link by the router, if the identification position is 777, the first part is 1500 in length, the valid load is 1480, the identification is 777, the offset is 0, and the flag is 1; the second part is still 1500 in length, and the identification is 777, offset is 185 (1480/8), flag is 1, third part is 1040 bytes, 1020 bytes of data, indentifis 777, offset is 370, flag is 0, mark as the last piece.
The payload of the datagram can be transmitted to the destination transport layer only when it is completely reconstructed as the initial IP data report. If a piece is lost, the incomplete datagram is discarded. However, if the transport layer is using TCP, TCP will restore the lost slices through the data in the source repeated datagram. However, I do not understand this in the book: TCP is an end-to-end, the lost parts may be sliced in the router, and the TCP transmission operation is a packet segment, how can the sender resend the corresponding lost part? However, if you follow the content in the previous chapter, you should discard all the slices and re-upload them directly. Because the slices are not data segments, TCP can only re-upload their data segments, or some details are not described in detail here.


IPv4 address:
The boundary between a host and a physical link is called an interface. The border between a router and a link is also called an interface. Because each host and router can send and receive IP datagram, each host and router interface must have its own IP address. Therefore, an IP address is technically associated with an interface, rather than the host or router that includes the interface.
Each IP address is a 32-bit, 4-byte IP address, and about 4 billion IP addresses. Each interface on each host and router has a unique IP address (except for interfaces after Nat ).
A vro can have multiple interfaces, while a host usually has only one interface. An interface of a vro can be connected to interfaces of multiple hosts, A network that does not contain a router can be an Ethernet LAN that is interconnected through an Ethernet Hub or an Ethernet link layer switch. In the IP address, the interface of the interconnected host and the network of an interface of the router form a subnet. IP encoding allocates an address for this subnet, for example, 223.1.1.0/24. The/24 method is sometimes called the subnet mask. It indicates that the 24-bit on the left of the 32-bit address defines a subnet address. Therefore, the address format of all networks in 223.1.1.0/24 is 223.1.1.xxx.
In the network, the point-to-point link between the router and the router is also a subnet. The broadcast link connecting the router to multiple hosts is also a subnet.
The Address Allocation Policy for the Internet is called classless interdomain routing CIDR for classless Inter-Domain Routing. The top bits in the address in the form of A. B. C. d/X constitute the network portion of the IP address, which is often called the prefix of the address. The remaining 32-x bits of an address can be considered to be used to differentiate devices in an organizational unit. These bits are considered only when forwarding groups within an organization. The organizational unit may also be able to divide subnets.
Before using CIDR, the Network part of the IP address is limited to 8 to 16 and 24 bits, and the subnet is called A, B, and C networks respectively. This addressing scheme is called classful addressing. A Class C Network/24 can accommodate a maximum of 254 hosts, two of which are reserved for special purposes. Class B Network/16 supports a maximum of 65534 hosts. This allocation wastes a large number of addresses for Small and Medium-sized subnets, resulting in low address space utilization.
IP broadcast address 255.255.255.255. When a host sends a data report with the target address, the report is delivered to all hosts in the same subnet.


Obtain an IP Address: If a subnet administrator wants to obtain an IP address, he or she will generally contact the ISP. the ISP will assign a block to the subnet administrator from the address block. You can also obtain it from ICANN. ICANN is not only responsible for allocating IP addresses, but also managing DNS root servers. It also allocates domain names and resolves domain name disputes.
Obtain the host address: For the router interface address, the system administrator manually configures the IP address in the vro and remotely configures it using network management tools. You can also manually configure the host, but more often use the Dynamic Host Configuration Protocol DHCP: The DHCP host can automatically obtain the IP address. The network administrator can configure DHCP so that the specified host can get the same IP address each time it connects to the network, or assign a temporary IP address. the IP address of the host may be different each time it connects. DHCP also allows a host to obtain other information, such as the subnet Code. Its first hop router address (called the default gateway) and its local DNS server address. DHCP provides an automatic processing function for the host to connect to a network. It is also known as the plug-and-play protocol. DHCP is a client/server protocol, and the new host is a client.
For a new host, DHCP performs the following four steps: 1. DHCP server discovery: the primary task for the new host is to discover the DHCP server that interacts with it. The host sends the DHCP discovery packet DHCP discover message to complete the process. The client sends the packet to port 67 in the UDP group, uses the Broadcast Destination Address 255.255.255.255, and uses 0.0.0.0 as the source address of the host. 2. DHCP server provides server offer: After DHCP receives the packet, it uses a DHCP server to provide the packet DHCP offer message to respond to the client. The destination address is still broadcast 255.255.255. The message contains the Message ID, IP address recommended to the client, network mask, and IP address least time during the IP address lease period. The lease period of a server is generally set to several hours or days. 3. DHCP request: the client selects one from multiple servers and responds to the selected server with a DHCP Request Message DHCP request message. The echo back configuration parameter configuration parameters is displayed. 4. DHCP ack: the server uses the dhcp ack packet to respond to the DHCP packet and confirm the required parameters.
When the client receives the dhcp ack, the interaction is complete, and the client can use the assigned IP address during the lease period. When a client exceeds the lease period, DHCP provides a mechanism that allows the client to update the lease period.


Network Address Translation NAT: in simple terms, it is the implementation of the router used in normal times. The router obtains an IP address from DHCP as the router address, and the router provides the address for multiple home user devices, so that multiple devices can connect to the network at the same time. Here, the address of the home user is the IP address reserved by the RFC 10.0.0.0/8 in the address space. These IP addresses are used for the network or the region realm with a private address. A region with a private address refers to a network where the address is valid only for devices in the network. Many home networks use the same address space. Nat routers recognize a single device with a single IP address for external behaviors. All messages sent from a home router to a larger Internet use the same source IP address, that is, the router address, all packets entering the home network are used for the same destination IP address. Nat hides the details of the home network from the outside.
The IP address of the router is obtained by the DHCP server of the ISP, and it runs a DHCP server to assign an IP address in a region with a VPC address to the computer in the home network. The vro uses the NAT translation table to determine the internal host to which the data is forwarded to the vro. The forwarding table contains the port number and IP address. When a host in the home network sends data to the LAN, Nat generates a new source port number for the datagram, which is currently used in the NAT translation table, and changes it, at the same time, change the source IP address to the IP address of the WAN-side interface on the WAN side, and add a new item to the conversion table. When a data report is sent from the WAN, Nat rewrites the destination IP address and destination port number of the data report based on the table items in the forwarding table, and forwards the data report to the home network.
Nat hinders P2P applications. If peer B is located in Nat, it cannot act as a server and receive TCP connections. Because it is very simple, the port number of the packet sent by A to B is the correct port number, but it cannot be found in the NAT translation table or may cause errors, so it cannot directly act as a server. The solution is to let B after Nat establish a TCP connection with the intermediate peer C, C is not in NAT and serves as the server, then a requests B through C, after a TCP connection is established, both parties can exchange messages and files. NAT traversal is called NAT traversal. If both parties are behind Nat, you need to use an application for relay.
Universal plug-and-play with Universal Plug and Play UPNP: This method is used for NAT traversal. This method allows the host to discover and configure Nat proximity.


Internet Control Packet Protocol Internet Control Message Protocol ICMP: Used to exchange network layer information between hosts and routers. ICMP is at the upper layer of the IP address, and the packet is carried in the IP datagram. An ICMP packet has a type field and an encoding field, and contains the first IP datagram header and the first eight bytes of content generated for the ICMP packet for the first time. The Ping program sends a packet of ICMP Type 8 encoding 0 to the specified host, and the received host sends back an ICMP echo response of the packet of Type 0 encoding 0. ICMP can also send source suppression packets, that is, force the host to reduce the transmission rate in case of congestion. Trancerout sends UDP packets and receives ICMP packets returned by the routes to determine the information and delay of the routers and routers in the path.


IPv6: the initial motivation for IPv6 development is that 32-bit address space is about to run out. Major change: Expanded address capacity: increases the IP address length from 32 bits to 128 bits. This ensures that IP addresses are not used up all over the world. In addition to unicast and multicast addresses, a new address called anycase address is introduced, which is a datagram delivered to any of the hosts. Simple and efficient 40-byte header: The New Option encoding allows more flexible option processing. Flow Label and priority flow labeling and priority: the exact definition of the stream in IPv6 is not completely determined, and its priority also indicates that the stream type is different.
Field of the datagram in IPv6: Version: 4 bits, 6. Traffic Type: 8 bits. Stream Tag: 20 bits, used to identify the stream of a datagram. Payload length: 16 bits. Next header next header: the same value as the Protocol field in IPv6 indicates the transport layer protocol to be delivered. Hop limit hop linmit: A hop passes through a vro. When the hop reaches 0, the datagram is discarded. Source and target addresses: 256 bits. Data: payload.
IPv6 does not have the offset and flag spaces. It is not allowed to group and reassemble on the intermediate router. These operations can only be performed on the source and destination. When a router receives an IPv6 data report that is too big to forward to the outbound link, it discards the data report and returns a Large ICMP error message to the sender. Then, the sender resends data using a small-length IP datagram. This greatly accelerates IP Forwarding in the network.
First inspection: because the transport layer and link layer protocols perform inspection operations, this operation is omitted at the network layer. Increase the speed.
Option: The option field is no longer part of the standard IP address header. The protocol header of TCP or UDP can be pointed out in the next header field of the IP Group. The option field can also be pointed out in the next header field. Deleting the option field leads to a 40-byte IP header.
It is very troublesome to upgrade IPv4 to IPv6. The dual-stack method is used temporarily, that is, IPv6 nodes also have the complete IPv4 function. When IPv6 and IPv4 nodes operate on each other, IPv4 is used. ipv6is used for both IPv6 nodes.
Another two-stack approach is tunnel tunneling, that is, the two IPv6 nodes are interconnected by the Intermediate IPv4 router. The set of IPv4 routers between the two IPv6 nodes is called tunnel, when an IPv6 enabling-capable node wants an IPv4 node to forward data reports, it needs to encapsulate the original IPv6 datagram in IPv4, and then unseal it when forwarding between IPv6 nodes.


IP Security: IPSec is a popular security network layer protocol, which is also widely used in Virtual Private Network VPN. The transport layer uses symmetric encryption algorithms to encrypt and decrypt packets when transmitting packets. IPv4 and IPv6 are not encrypted, and there is almost no security.




Routing algorithm:
In the datagram service, different groups may use different routes between the given source and destination. Because of the existence of routing algorithms, when it updates the forwarding table in the route, the group may be forwarded through different routes, and the virtual circuit uses the routing algorithm to fix all paths at the beginning, so the same path is used for packet transmission.
The router directly connected to the host is called the default router of the host. This is also called the First-hop router. The default router of the source host is the source router. Similarly, the default router of the target host is called the destination router. The routing problem is from the source router to the destination router. The general purpose of routing is to select a good path, that is, the path with the lowest cost.
Graph graph is used for formal routing. The figure here is an undirected graph. The routing method is to select the least-cost path at the lowest cost path. The cost can be the physical length of the link, the link speed, or the financial cost of the link. C (X, Y) is the fee between two nodes. When a node pair does not belong to a network EIP, C (x, y) = ∞. If the side (x, y) belongs to E, XY is the neighbor neightbor.
Routing Algorithms can be classified into global or distributed ones:
Global routing algorithm global routing algorthm: calculates the minimum fee between the source and destination with complete global network information. The algorithm uses the connectivity among all nodes and the cost of all links as the input. Computing can be run at a certain site (centralized centrailized global routing algorithm), or redundant at multiple sites. In this way, an algorithm with global status information is called the link-state LS algorithm.
Distributed routing algorithm decentrailized routing algorithm: calculates the lowest cost path in iterative distributed mode. Each node can start to work with only the cost information of the link directly connected to it. Through Iterative Computing and information exchange with adjacent neighboring nodes, a node gradually calculates the minimum fee for reaching the destination node or a group of destination nodes. Distance vector distance-vector DV algorithm, each node maintains the vector of cost estimates for all other nodes in the network.
Routing Algorithms can also be classified based on static or dynamic algorithms. In the Static Routing algorithm, the routing transformation is very slow. It is usually adjusted by manual intervention, such as manually editing the forwarding table of the vro. Dynamic dynamic routing algorithm: Change the routing path when the network traffic load or topology changes. Dynamic algorithms run cyclically or directly respond to changes in topology or link costs.
The routing algorithm can also be classified based on its load sensitivity or load slowness: the load-sentitive algorithm dynamically reflects the current congestion level of the underlying link. The current routing algorithm is slow in load, and the link cost does not significantly reflect the current congestion level.


Link Status routing algorithm: the network topology and the cost of all links are known. Each node router needs to broadcast the link status groups of all other routers in the network. Each link status group includes the characteristics and costs of the links connected to the router. Implemented by the link status broadcast link State broadcast algorithm.
Use the Dijkstra algorithm to calculate the lowest cost path. Dijkstra is an algorithm used to calculate the Shortest Path in graph theory. It is an iterative algorithm that iterates K times to know the minimum cost path for K nodes in the network. Note: d (v): The lowest cost path from the source node to the target node V with the algorithm iteration. P (v) is the previous node (the neighbor of V) from the source node to the target node v along the current lowest cost path ). 'N' is the subset of nodes, and a node is added to the subset of nodes in each iteration. When node v is added to n', the lowest cost path has been determined.
The global routing algorithm consists of an initialization step and a subsequent cycle. The number of cycles is the same as the number of nodes in the network. Here is the Dijkstra algorithm in the data structure, but it is described in detail. After the node is added to the source node in the initialization phase, the cost of the node connected to the source node is ∞, and P (v) of the previous node is the source node. Then, during iteration, find the lowest cost node that is not added to the n 'set and add it to the n '. Update all the d (v) nodes. When the cost from the source node to the target node is lower, update DV and P (V ). Repeat iteration. Then, we can obtain the first node of the lowest cost path from each node to the source node, and select the complete shortest path from the source node to all target nodes. By storing other nodes as the first node from the source node to its lowest cost path, you can build a forwarding table for this node. The worst case is O (n ^ 2)


Distance vector algorithms: distance vector algorithms are iterative, asynchronous, and distributed dirtributed. Bellman-Ford equation: d x (y) = min v {C (x, v) + d v (y )}; that is, the minimum fee between x and y is the sum of the link fee between x and the lowest fee to Y on all nodes connected to X, this node is the next hop of the x node to forward the group. At the same time, this equation puts forward the form of neighbor-to-neighbor communication in the DV algorithm: the basic idea is that each node x starts with dx (Y) and the cost between all nodes in N is estimated. So that dx = [dx (y): Y ε n] is the distance vector of node X, and the cost estimation of all the nodes from X to N is saved in the vector. Using the DV algorithm, each node maintains the following data: direct cost to the neighbor C (x, V); distance vector of the node; Distance Vector of all neighboring nodes. In this distributed asynchronous algorithm, each node sends a distance vector copy to each of its neighbors from time to time. When the node receives the distance vector, it also uses the equation to update its own distance vector. If the distance vector of a node changes due to this update step, the node wants all its neighbors to send the updated vector.
In the DV algorithm, what a node needs to know is not the Shortest Path Distance from X to Y, but the Shortest Path Distance from a neighbor node. The node selects the neighbor node in the shortest path as the next hop router, and updates the forwarding table to the destination y accordingly. In the routing table, each row of the routing table is a vector. At first, no other router is known, so the cost is infinite. Then, each vector sends its own vector to each other, receives computation, and sends it again... Wait until no updates are updated and enter the static state.
Link Cost Change and link failure: When the node running the DV algorithm detects a change in the link cost from it to its neighbor, it updates the distance vector, if the cost of the lowest cost path also changes, notify the neighbor of the updated distance vector. When a node does not correctly receive the update of the distance vector, it is similar to the following: in a network composed of three routers X, Y, and Z, X does not obtain the correct distance vector from Y to Z, but considers that the path from X to Y to Z is the shortest, and then the group is forwarded to y, and forward the calculated new distance vector to Y, and Router Y receives the error-Based Distance Vector sent from X, in this way, the correct part of the distance vector is updated. That is, Y thinks that X has found a shorter path and determines that the path from Y to X to Z is the shortest, the Group is also sent back to X, and the correct distance vector is updated, and the new error distance vector is re-sent to X, and then cyclically encountered a routing loop. In each back-and-forth process, the distance will increase the cost of this link until the wrong distance vector between the two is updated back and forth to break the loop, and the loop will exit.
Increase toxicity reversal poison reverse: that is, when Z reaches the destination X through Y, Z will notify y that the distance from Z to X is infinite, As long as Z is selected to X through y, it will continue this state. However, loops designed with three or more nodes cannot be detected by the toxicity Reversal Technique.


Comparison of LS and DV routing algorithms: Message complexity: The LS algorithm sends more packets, and all nodes must send new link information whenever the cost of a link changes. Convergence Speed: the DV algorithm is slow to converge, and the loop is still counted to an infinite number. Robustness: When a router fails, the LS node only computes its own forwarding table. To some extent, the router is isolated, while the DV algorithm, A small fault will lead to a large number of errors.


Hierarchical routing: scale. As the number of routers increases, the computing and storage of routing information (that is, the communication overhead) increases greatly. the overhead of broadcasting and transmission in LS will occupy a large amount of bandwidth, however, iterations of DV algorithms will never converge. Management autonomy: An organization wants to be able to operate and manage its networks as desired, and to connect its networks to external networks.
These two problems are solved by organizing the routers into the autonomous system autonomou system. Each as is composed of a group of routers under the same management control. All routers in the same as run the same routing algorithm, and the internal routing protocol is called the internal routing protocol of the autonomous system and has information between each other. One or more routers in the as are responsible for forwarding groups to external destinations. These routers are called Gateway Router routers. Communication between two as systems uses Autonomous System routing information inter-Autonomous System routing protocol, and bgp4 is used on the Internet.
With hot potato routing options, as is as fast as possible (as low as possible) to get rid of groups. A vro sends a group to a gateway router, and the minimum fee is required for all gateway routers in the Gateway Router to the destination path. That is, after the vro selects the gateway, it quickly sends the group and decides to use the Gateway Router. Then, it selects the lowest cost path and adds the actions used for the table items of X to its forwarding table. ISP contains one or more. The vro in the as instance only needs to know the vro in the as instance.


Routing in the Internet:
The Autonomous System in the Internet has two routing protocols: routing information portocol rip and Open Shortest Path First OSPF.
Rip: it is a distance vector protocol that uses the number of hops as its cost measurement, that is, the cost of each link is 1. A hop is the number of subnets that have elapsed since the shortest path from the router to the destination subnet, including the destination subnet. The maximum cost of a path is limited to 15, and rip is limited to autonomous systems with a network diameter of no more than 15 hops. In rip, the routing update information is exchanged between neighbors through the rip response packet, Which is exchanged every 30 seconds. Each router maintains a rip table called the routing table, the distance vector and forwarding table of the vro are displayed.
OSPF: A link status protocol that uses flood link status information and a Dijkstra lowest cost path algorithm. Using OSPF, A vro constructs a complete topology of the entire autonomous system. The cost of each link is configured by the Administrator and periodically broadcast to adjacent routers to ensure robustness. Advantages of OSPF: security, multiple identical cost paths, comprehensive support for unicast and multicast routing, and support for hierarchical structures in a single routing domain. In an as region, one or more regional border routers are responsible for routing to groups outside the region. One region in an as instance is configured as the trunk backbone. The trunk region is traffic routing between other regions in the as instance. The trunk contains vbrs in all regions in the as instance. Vrouters are divided into internal routers, regional border routers, backbone routers, and border routers.
BGP between autonomous systems: Border Gateway Protocol Broder Gateway Protocol


Broadcast and Multicast Routing:
Broadcast routing: the network layer provides the service of delivering groups from a source node to all nodes in the network. Multicast Routing: each source node can send a copy of a group to a subset of other network nodes.
Broadcast routing algorithm: N unicast is the simplest, but its efficiency is low. Flood flooding: This method requires the node to send a copy of the Group to all its neighbors (except the neighbor of the receiving group) After receiving the broadcast group. Its disadvantage is fatal. If there is a circle in the figure, that is, the broadcast group will loop infinitely in the network. In this case, there is a more critical defect. When a node is connected to multiple nodes, multiple copies are generated and forwarded, resulting in a broadcast storm. Controlled flood: nodes can use some restrictions to intelligently select when to flood a group. There are multiple ways to limit: Serial Number Control: the source node puts the address and broadcast serial number into a group, and other nodes will assign values to the information in a list and maintain it, check whether the group is in the list. Reverse route forwarding RPF: the basic idea is that after a vro receives a broadcast group with a given source address, only when the route to the group is located on its own to its source's shortest unicast path, it transmits packets to all outbound links. The principle is that each node has only one shortest unicast path, so each node is destined to be transmitted only once. Spanning Tree broadcast: converts an image to a minimum spanning tree and determines the propagation based on the minimum number of generated trees.
Multicast: multicast datagram uses an indirect address for addressing and an identifier to represent a group of receivers. This identifier is a Class D multicast address. Internet Group Management Protocol (IGMP): runs between the first vro of a host and provides a means for the host to manage the group. Multicast Routing Algorithm: This algorithm uses a source-based number for Multicasting and pruning to delete unwanted multicast groups. The multicast protocol used in the Internet is the multicast routing protocol PIM of the Protocol Gateway.







Computer network 4. Network Layer and IP protocol

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.