Linux Network Administrator Manual (5)

Source: Internet
Author: User
Tags ftp site
Article title: Linux Network Administrator Manual (5 ). 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 5 TCP/IP network configuration
In this chapter, we will discuss all the steps to set up a TCP/IP network on a machine. We will
Configuration starts, and describes the configuration process of TCP/IP network interfaces step by step. It also introduces several
Tool used.
Most of the work described in this chapter is usually only required once. Then, only when you want to add a new system to the network, or
When you completely reconfigure your system, you will be exposed to many configuration files. However, some of them are used to configure TCP/IP
It must be executed every time the system is booted. This is usually done by calling them in the system's/etc/rc script.
.
Generally, the network VPC part of this process is included in the script called rc.net or rc. inet. Sometimes, you will also see
The two script files named rc. inet1 and rc. inet2, the previous one is used to initialize the core part of the network, while the latter starts
Basic network services and applications. In this chapter, I will focus on the latter's concept.
Next, I will discuss the results of executing rc. inet1, and the applications will be discussed in later sections. After reading this chapter
Then, you will establish a command order for correctly configuring TCP/IP on the computer. Then you should replace rc on the computer
Any example command in. inet1, make sure rc. inet1 is executed during system boot, and reboot your machine. With
The network rc script from your favorite Linux version will give you a good example.
5.1 install the proc file system
Some Net-2 configuration tools depend on the proc file system to communicate with the kernel. This is a file system
Similar mechanism to allow access to kernel runtime information. When loading, you can use any other file
The system lists files or displays their contents in the same way. Typical items include loadavg files with average system load,
Or meminfo that displays the current core memory and swap usage.
The net directory is added to the network code. It contains many files, such as kernel ARP tables, TCP connections
Status, and the routing [select] table. Many network management tools obtain their information from these files.
Proc file systems (or also known as procfs) are usually loaded to the/proc directory during system boot. Best practice
Add the following lines to/etc/fstab:
# Procfs mont point:
None/proc defaults
And run "mount/proc" from your/etc/rc script ".
By default, procfs is now configured in most kernels. If procfs is not in your kernel, you will get
Sample message: "mount: fs type procfs not supported by kernel" ("loading: kernel does not support text
Component System Type (procfs "). You must re-compile the kernel and answer "yes" when asked about procfs support ".
5.2 install the execution file
If you are using a package earlier (unpackaged) Linux release version, it will probably include the main network
Use Programs, utilities, and a set of attached example files. You may have to obtain and install the new tool only when
You have installed a new kernel version. Because they sometimes contain changes at the kernel network layer, you will need
New basic configuration tool. This includes at least re-compilation, but sometimes it is necessary to obtain the latest execution file group. These connections
It is usually issued with an internal license. it is packaged in the form of a document and called net-xxx.tar.gz. here XXX is the version number. And Lin
The matching value of ux 1.0 is 0. 32b. The latest kernel (1.1.12 and later) in this book requires 0.32d.
If you want to compile and install standard TCP/IP network applications by yourself, you can
Obtain the original program. These are program versions that are more or less modified from Net-BSD or other original programs. Other applications
Programs, such as Xmosaic, xarchie, Gopher, and IRC, must be obtained separately. Most programs
If compiled according to the instructions, it is the same as the boxed version.
The official Net-3 FTP site is sunacm. swan. ac. uk. The image site is located in system/Net under sunsite.unc.edu.
Work/sunacm. The latest Net-2e patch as well as the executable program on ftp.aris.com. Starting from Matthias Urlichs
Programs originating from BSD network code are available on ftp.ira.uka.de. in/pub/system/linux.
5.3 another example
In the rest of this book, let me introduce a new example, which is simpler than the Groucho Marx University example,
And it may be closer to your actual problems. Consider Virtual Brewery, a small
Brewing-as the name suggests-virtual beer companies. To better manage their business, virtual Brewing
People want to connect their computers to the internet. these are just running bright and shiny 1.0 (bright and shining 1.0 ).
PC.
On the same floor, just across the hall, there was a grape winery with similar jobs. They have their own
Ethernet. Naturally, once their networks start to work normally, the two companies want to connect their networks
. As the first step, they want to set up a gateway host to forward data packets between the two subnets. Next
They also want to have a UUCP connection with the outside world. through this connection, they can exchange emails and news.
. Finally, they also want to install a SLIP connection so that they can sometimes connect to the Internet.
5.4 Set host name)
In most cases-if not all, network applications must rely on setting the local host name properly. This connection
The hostname command is usually executed during the boot process. If you want to set the host name to name, it calls
For example
# Hostname name
It is also common to use any host name that has nothing to do with any domain name. For example, a virtual brewery host may be called
Vale.vbrew.com and vlager.vbrew.com. These are their formal and wholly-owned domain names. Their local landlords
The host name is the first part of the name, such as vale. However, because the local host name is often used to find the host's IP address
You must be sure that the DNS database can find the IP address of the host. This usually means you have to write this name to/e
Tc/hosts (see below ).
Some people suggest using the domainname command to set the remaining part of the domain name in the kernel sense as FQDN. In this case, you
You can combine the output of hostname and domainname to obtain the FQDN again. However, this is up to half right. Domainna
Me is generally used to set the NIS domain of the host, which may be completely different from the DNS domain of your host. NIS will discuss in chapter 10
Theory.
5.5 assign an IP address
You can
This section is skipped safely, because you only need to allocate an interface for the loopback interface, which is always 127.0.0.
1.
For a real network like Ethernet, things are complicated. If you want to connect your host to
On a ready-made network, you must ask the administrator of the network to give you an IP address of the network. When the entire network is composed
When you set the IP address, you must assign the IP address as described below.
Hosts in a local network usually have the same logical IP address. Therefore, you must assign an IP address.
Address. If you have several physical networks, you must assign them different network numbers (network addresses) or
Use the subnet technology to divide your IP address range into several subnets.
If your network is not connected to the Internet, you can freely select any (legal) network address. You only need
Make sure you have selected one of class A, Class B, or class C. Otherwise, things may not work properly. However, if you want
To connect to the Internet recently, you need to obtain a formal (official) IP address. The best method is
Please help your network service provider. If you want to obtain a network address, just In case one day you may connect to In
Ternet, from hostmaster@internic.net to a network address application form.
To operate on several Ethernet networks (or other networks, once drivers are available), you must separate your networks into subnets.
Note: only when you have multiple broadcast networks (broadcast network), you need to apply the subnet technology; point-to-point
Is not included. For example, if you have an Ethernet and one or more SLIP links to the external world
You do not need to divide your network. The reason will be given in Chapter 7th.
As an example, the network manager of the brewery applied for a class B network number from NIC and obtained 191.72.0.0. Is
In response to two Ethernet connections, she decided to use the eight bits in the host part as the extra subnet bits. Remaining 8 hosts
BITS. Each subnet can have 254 hosts. Then she gave subnet 1 to the winery and subnet 2 to the wine factory.
In this way, their network addresses are 191.72.1.0 and 191.72.2.0 respectively. The subnet mask is 255.255.255.0.
The Gateway vlager between the two networks is allocated to its host number 1 on both sides, which respectively gives its IP address 191.7.
2.1.1 and 191.72.2.1 .. 1 shows the two subnets and gateways.
Note: In this example, I use a class B network to simplify things. a Class C network will be more realistic.
. With the new network code, subnet division is not limited to byte boundaries, so even a class C network can be split.
Into several subnets. For example, you can use a 2-bit host as the network mask to obtain four possible subnets,
Each subnet can have 64 hosts. [1]
5.6 compile hosts and networks files
After dividing your network into subnets, you should use the/etc/hosts file to prepare for some simple host name resolution.
. If you do not want to use DNS or NIS for address resolution, you must write all the host names to the hosts file.
  
. 1 virtual winery and virtual wine factory-two subnets.
Even if you want to run DNS or NIS during normal operation, you will still write some host names to the/etc/hosts file. I
The reason is that even if no network interface is running, you still want to have some name resolution functions, such
Import period. This is not only for convenience, but also allows you to use the symbolic host name in the rc. inet script. In this way, when you change
When the IP address is used, you only need to copy the updated hosts file to all machines and restart the machine. No need to go
Edit a large number of rc files respectively. Generally, you should put all the local host names and addresses in hosts and add any
The name and address of the Gateway and NIS server. [2]
Similarly, in the initial test phase, you should be sure that your parser only uses the information in the hosts file. Your DNS or
NIS software
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.