Linux Review Memorandum 8

Source: Internet
Author: User

Linux Review Memorandum 8 is the eighth article in this series. Starting from this article, the basic knowledge of the system has been roughly introduced. The following describes the configuration of the network and related applications, of course, the previous article is a bit simple, mainly because it takes time to type !!! A lazy person like me can give me an outline to remind myself that it is already a great experience. First, let's talk about the TCP/IP protocol. This is a factual standard. After the International Organization for Standardization defines the so-called OSI Layer-7 Protocol (which is not actually applied ). Let's take a look at the layer chart: 8.1 Basic Knowledge: TCP is the transmission control protocol, and IP is the Internet protocol. TCP and UDP are the transmission protocols used to transmit packets to specific applications based on IP addresses. TCP is a connection-oriented protocol, which is a bit like a phone. Reliable and controllable transmission over TCP. UDP is a group-oriented service, similar to the Post Office Mail principle. UDP is a non-connection protocol. It does not guarantee the receipt and sending order of the group, nor does it ensure that the Group can arrive at the destination correctly. 8.2 network connection technology overview when TCP/IP is a protocol family, it not only includes the two transport layer protocols, but also includes ICMP, APR and other IMCP protocols as the underlying support protocol of ipprotocol, ARP is the Address Resolution Protocol, which is also common for various tests. 8.2.1 grouping and encapsulation in the network. High-level protocols do not care about the underlying layer. They seem to be black boxes. This is a very important concept in computers, called encapsulation. Data is transmitted in groups over the network. Each package consists of a packet header and a payload. The name of the original data unit depends on the protocol layer. The link layer is called frame, the IP layer is called packet, and the TCP layer is called segment ); when a packet is transmitted down the protocol stack, each Protocol adds its own header. This nested process is called encapsulation, and the opposite inverse process at the receiver is called unblocking. 8.2.2 link layer This section describes the content of the link layer. The main task of the link layer is to add a frame header to the data frame and a separator between frames to distinguish different frames, frames are also formatted as standard files. 8.2.3 there are basically three solutions for addressing the package: MAC for hardware, IP for software, and host name addressing for human use. We should be familiar with MAC addresses, this is an address initialized at the factory of the NIC. Of course, you can pretend to be the address in the system. I will not explain it. MAC addressing is a link layer-based addressing method. The ing between IP addresses and hardware addresses is also implemented at the link layer: ARP. This Protocol is at the link layer. 8.2.4 The IP port IP Address indicates the network interface of the computer. However, for services and processes, an IP address cannot distinguish different processes. Therefore, the port concept is derived. In linux, the port numbers of service programs are lower than 1024, except for processes running as root. 8.3 The IP address details are divided into the network part and the host part. 8.3.1 traditionally, IP addresses are classified into Class A, Class B, and class C addresses. However, this category does not have any practical significance. A bit: Class A address: the first byte value: 1-126; Class B address: 128-191; Class C address: 192-223 8.3.2 subnet and subnet mask for Class A and Class B networks, there are too many host numbers, and A large number of addresses are wasted, so the concept of subnet emerged, to make more effective use of IP Address resources. That is, we can convert a Class B address into multiple Class C addresses in the form of a subnet mask. The mask means to set the network mask position of the brother in the Network part of an IP address to 1, the host space is 0. The common mask is 255.255.255.0, which is the mask of class C addresses. However, as the number of computers on the network increases, the form of dividing subnets is gradually insufficient. Currently, CIDR classless domain routing is used, in the IP/26 notation, the first 26 bits are the network part, the first two bits in the last byte are the network signs, and the last byte is changed to a mask of 11000000. Therefore, we can divide IP Address/24 into four IP addresses/26 networks. In this example, the remaining six digits of IP Address/26 indicate the host address. If it is normal, it should be 64 hosts, however, the addresses of all 0 and 1 are reserved, so 62 addresses are actually available. If you are interested, you can continue to study it and do not describe it in detail. In actual application, this is basically useless, but it is a basic knowledge. 8.3.3 CIDR is short for classless domain routing classification. It abolished the previously fixed ABC Classification Method and directly expanded the subnet method. This term is also mentioned in the previous section. You can understand it. 8.3.4 the configurations related to private addresses and NAT will be discussed later. Here we will only mention their usage. We know that IP addresses need to be applied, but our internal network expansion is very rapid, and there is no need for each internal host to need an external IP address, so the concept of private IP addresses has emerged, the RFC stipulates that A class A network, 16 class B networks, and 256 Class C networks are used as private addresses. These addresses can be used internally for your own use. They can be divided into subnets and allocated addresses. To allow internal hosts to access external networks, a NAT service is generally required to map addresses and ports, that is, all internal IP addresses share a real Internet address. Is this a disadvantage, that is, internal hosts cannot be accessed from outside, but in a specific situation, this seems to be an advantage. 8.4 ARP Address Resolution Protocol the ARP Protocol should be an important protocol. An IP packet is sent based on the IP address. The actual hardware address must be used on the link layer to transmit data, so ARP is generated. Each computer maintains a table named ARP cache in the memory and stores the results of recent ARP queries. For this protocol, remember to play a role in the form of broadcast. There is also a command: arp, which can display the content of the ARP cache. 8.5 Add a host to the network as the system administrator. Sometimes, you need to add a host to the network. We need to do the following: 1. assign IP addresses and host names; 2. Set network interfaces; 3. Set Default routes; 4. Specify a DNS server. 8.5.1 the commands/etc/hosts and hostname may be involved in the allocation of IP addresses and host names. This is not the focus of this section. This section involves another important command: the ifconfig command is very familiar to everyone, and there are similar commands in the win system, ipconfig. the basic format of this command: Ifconfig interface address options .... for example, Ifconfig eth0 192.168.100.1 netmask 255.255.255.0 up --- interface is the name of the hardware interface used by the command. Eth0.address is an IP Address listed in most systems, if it is statically allocated. Netmask is a subnet mask, which is an interface for starting Up. The mii-tool command can be used to query and set parameters for a specific interface. Full/half-duplex mode is required. However, unless necessary, it generally does not need to be changed by default. 8.5.2 configuring the default route is to specify the gateway address. Command: Route add default gw gateway-IP-address 8.5.3 configure DNS. The key is to configure the/etc/resolv. conf file. You only need to edit this file and add the corresponding DNS server address.

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.