Linux Network Administrator Manual (2)

Source: Internet
Author: User
Article title: Linux Network Administrator Manual (2 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Chapter 2 TCP/IP network problems
We will go to discuss some of the details you will encounter. when you connect your Linux machine to the TCP/IP network
Using these details involves IP addresses, host names, and sometimes routing problems. This chapter shows what you need
Background information for understanding your setup requirements. the next chapter will discuss some of these tools.
2.1 Network Interface
To hide the differences between devices that may be used in the network environment, TCP/IP defines an abstract interface ),
Use this interface to access the hardware. This interface provides a set of operations, which are the same for all hardware types.
And basically involves sending and receiving groups.
For each type of peripheral device that you want to connect to the network, you must have a corresponding interface in the kernel. For example
The interfaces of the listener are eth0 and eth1, and the interfaces of the SLIP are sl0 and sl1. These interface names are used for configuration purposes,
Then you want to name the kernel a specific physical device. It has nothing to do with it.
To be useful for TCP/IP connection, an interface must be assigned an IP address.
Its function of identification and recognition. This address is different from the interface name mentioned above; if you compare an interface to a door
The address is like a famous brand name on the door.
Of course, there may be other device parameters that need to be set. one of them is the maximum datagram that a specific hardware can process.
Is also called the Maximum transmission Unit (Maximum Transfer Unit), or MTU. Other attributes will be introduced later
.
2.2 IP address
As mentioned in the above chapter, IP network protocols can understand the IP address as a 32-bit number. Each machine must be assigned one
A unique number for the network environment. If you run a gossip network that does not communicate with other networks through TCP/IP
You can allocate these numbers based on your interests. However, for websites on the Internet, these numbers
It is allocated by a central authority, Network Information Center (Network Information Center or NIC. [
1]
For ease of reading, IP addresses are divided into four eight-bit numbers called OCTs ). For example, quark. phy
Sics.groucho.edu has an IP address 0x954C0C04, which can be written as 149.76.12.4. This format is usually called
It is a four-point representation (Dotted quad notation ). [Also called dot-decimal notation Dotted
Decimal notation-translator's note]
Another reason for this representation is that the IP address can be divided into a network number in the octal group that contains the beginning (left ).
(Network number) and one host number (host number) contained in the remaining (right) eight-bit group ). When
When the IP address is used according to the NIC rules, it is not for you to allocate an address for each host you plan to use, but for you
Network number, and allows you to allocate the network number range to each host on your network according to your preferences
Any valid IP address is available.
Depending on the size of the network, the host part of the IP address can be large or small. To meet different needs, several categories are defined.
Network, which provides different IP address segmentation methods.
Class A consists of A network from 1.0.0.0 to 127.0.0.0. The network number is included in the first octal group. This provides
A 24-bit host. each network allows about 1.6 million hosts.
Class B includes a network from 128.0.0.0 to 191.255.0.0. the network number consists of the first two octal groups. In this way, you can
There are 16320 networks, and each network can have 65024 hosts.
The Class C network ranges from 192.0.0.0 to 223.255.255.0. The network number consists of the first three octal groups. It can be near
2 million networks, each of which can accommodate 254 hosts.
Class D, E, and F addresses range from 224.0.0.0 to 254.0.0.0 for trial purposes or reserved for future use, with no score
Assigned to any network.
If we refer to the example in the previous chapter, we find that the quark address 149.76.12.4 corresponds to
12.4 of hosts.
You may have noticed that the host listed above is not applicable to all values in each octal group. This
The reason is that the host numbers in the eight-bit group are all 0 or 255 reserved for use. All bits of the host are completely zero
It is used as a network, and all the bits in the host part are called broadcast addresses. It also refers to
All hosts. Therefore, 149.76.255.255 is not a valid address, but all hosts on the 149.76.0.0 network.
.
There are also two network addresses 0.0.0.0 and 127.0.0.0 which are also retained. The first one is called the default rout
E), the last one is called the loopback address ). The default route is related to the IP route datagram method.
It will be discussed below.
The network address 127.0.0.0 is retained for IP communication within your host. Generally, the address 127.0.0.1 will be assigned to
A special interface is called a loopback interface. it acts like a closed circuit. Slave
Any IP group sent by TCP or UDP will be sent back to them, as if this group was just uploaded from a certain network. This
This allows you to develop and test network software without having to use a "real" network. Another useful application is
When you want to use network software on a single machine. This is not as rare as it sounds; for example, many UUCP sites simply
There is no IP connection, but the INN News system still needs to run. In order to work properly, the INN needs a return interface.
2.3 Address Resolution
Now you know how IP addresses are formed. you may find it strange that they are used for encoding over Ethernet.
Addresses of different hosts. After all, the Ethernet protocol is identified by a number of six octal groups that are completely different from the IP address.
Don't host, Don't you?
Yes. This is why we need a mechanism to map IP addresses to Ethernet addresses. This is the so-called Address Resolution Association.
Address Resolution Protocol, or ARP. In fact, ARP is not limited to Ethernet at all. it can also
It is used for other types of networks, such as amateur radio enthusiasts. The basic concept of ARP is that people are in a group of 150 people.
Most people look for Mr. X. Ample in the same way: they surround the crowd, yell at his name, and are sure that
If he is there, he will definitely respond.
When ARP wants to find the Ethernet address corresponding to the given IP address, it uses the Ethernet "broadcast" feature.
Data packets are simultaneously addressed to all sites on the Internet. The Broadcast Datagram sent by ARP contains queries on the corresponding IP address. Each
The host compares the received IP address with its own IP address. if the IP address is the same, an ARP response is returned to the master
Machine. The host that sends the query can extract the sender's Ethernet address from the response datagram.
Of course, you will be surprised, how can a host know that it can find the desired master on countless Ethernet networks around the world?
What about machines? And why must it be Ethernet? These problems involve operations called route selection, that is, searching on the network.
Find the physical location of a host. This will be the topic of the next section.
Now let's talk about ARP later. Once a host discovers an Ethernet address, the host stores it in
ARP buffer, so that the host does not query its Ethernet
Network address. However, it is unwise to store such information permanently. for example, the Ethernet card on a remote host May
If it is replaced due to technical issues, the ARP registration item becomes invalid. To force another IP address
The items in the query and ARP buffer are discarded after a period of time.
Sometimes, you need to find the IP address corresponding to the given Ethernet address. When a diskless machine wants a service from the internet
This is often the case on the LAN. However, a diskless customer does not
Have information about yourself-in addition to knowing your own Ethereum website! Therefore, it mainly needs to broadcast a request to the boot server.
The message that the server tells the consumer about its IP address. For this purpose, there is another protocol named Reve
Rse Address Resolution Protocol), or RARP. Together with the BOOTP protocol, it is used to specify online guidance
No disk.
2.4 IP route selection
2.4.1 IP network
When you write a letter to someone, you usually write the complete recipient address on the envelope, listing the country, state, and postal code.
Code. When you put a mail in your mailbox, the Postal Service will send it to your destination: it will be sent to a specified country,
The country's postal service will distribute it to the right state and region, and so on. The advantages of this hierarchical solution are obvious:
No matter where you send this letter, the local postman will probably know the direction of the letter to be delivered, but it is not
In the country where the mail is delivered.
The structure of the IP network is similar. The entire Internet is composed of many VPCs, called autonomous systems (
Autonomous systems ). Each such system executes various routing options between its internal member hosts.
The task of distributing a datagram is simplified to finding a path to the target host network. This means that once the Datagram
The network itself is specially processed on any host on that particular network.
2.4.2 subnet (Subnetworks)
This structure is reflected by dividing an IP address into a host and a network. By default
The network part of the network from the IP address. Therefore, hosts with the same IP address number are on the same network, and vice versa. [2
]
It is also reasonable to use similar solutions within the network, because it may have many smaller networks and the smallest single
It can be a physical network like Ethernet. Therefore, IP allows you to divide an IP network into several subnets (su
Bnets ).
On the IP network to which the subnet belongs, the subnet takes over the responsibility of distributing data to a specific IP address range. For Class A, Class B, or Class C
Network, which is determined by the network part of the IP address. However, the network is now expanded to several
Bit. The bits that are interpreted as subnet numbers are composed
The value specified by netmask. This is also a 32-bit value, which specifies the mask of the IP address network.
.
. 1. Divide the B-type network into subnets
Groucho Marx University's campus network is an example of such a network. Its Class B network number is 149.76.0.0, and its network
The mask is 255.255.0.0.
Internally, the GMU campus network is composed of several smaller networks, such as local networks of various systems. So the IP address range is
Minute

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.