Design of a Linux-based network test system (2)

Source: Internet
Author: User
Article Title: Design of a Linux-based network experiment system (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 Linux system configuration
  
Section 1 Linux network settings
  
TCP/IP is the most widely used networking protocol in Unix, and Linux is no exception as a Unix-like operating system. Linux has taken it as an inseparable part since its birth. The Linux system kernel directly provides powerful support for the network. it supports many network devices (from Nic, Modem, ISDN adapter to various routers, etc ), in addition, it inherits many excellent network software from Unix, so that Linux has excellent network performance. Linux not only supports some existing network protocols, but also prepares to support some new protocols, such as IPv6, because thousands of network experts on the Internet are involved in its development, some test versions are available. Because the experiment system is a network experiment system based on Linux, it is necessary to study the network configuration characteristics of Linux and the configuration and management methods.
  
Nic installation:
  
Linux supports various Ethernet NICs in the kernel. you only need to compile the network support and driver of the NIC model to the kernel during kernel compilation. Generally, the support code for NICS is compiled into dynamically loaded modules.
  
With kernel support, we must also pass the Nic I/O terminal number (0x320 for this website) and interrupt number (11 for this website) to the kernel, in this way, the system can truly control the network card for network communication. We must load it in the file/etc/conf. modules (the system also loads the sound card module). the content of this file is as follows:
  
Alias eth0 ne
  
Options ne io = 0x320 irq = 11
  
Alias sound sb
  
Alias midi opl3
  
Options opl3 io = 0x388
  
Options sb io = 0x220 irq = 7 dma = 1 mpu_io = 0x201
  
We can also configure through the integrated GUI program and run linuxconf in the terminal window to perform most of the settings.
  
IP address and Nic settings
  
We will use the control panel to load the configuration program. The following window will appear when running the controlpanel, which contains many configuration tools, from the system daemon process, network settings, user management, software package installation to the configuration program of the www server Apache, everything is available.
  
Select network configuration in the control panel. the following window appears.
  
Click Add in. the following window is displayed:
  
Enter the IP address 172.31.0.10 of the computer in the IP field, the network mask is 255.255.255.0, and the others are the default values. Select Done to exit.
  
In addition, you can add the corresponding content to the configuration file. Create a file Network under/etc/sysconfig. the content of the file is as follows:
  
NETWORKING = yes
  
FORWARD_IPV4 = false
  
HOSTNAME = LinuxServer.ec.edu
  
DOMAINNAME = ec.edu
  
GATEWAY = "172.31.0.200"
  
GATEWAYDEV = "eth0"
  
II. Access Gateway settings:
  
In the network configuration window, select Routing ,:
  
Click Add in the preceding figure. the following window is displayed. Enter eth0 in the device column, Network words (Network mask and Gateway phase) in the Network, and Network mask 255.255.255.0 in the Netmask, enter the Gateway address 172.31.0.200 (the gateway address of the lab) in the Geteway column ). Select Done to exit.
  
Another method is to write the configuration file directly and create the file static-routes in/etc/sysconfig. its content is:
  
Eth0 net 172.31.0.0 netmask 255.255.255.0 gw 172.31.0.200
  
III. test network connection and running status
  
1. test the communication with other subnet clients. Use the ping command to test the IP address 172.31.0.105:
  
In the terminal window, type "ping 172.31.0.105". The Linux host will send an information package to the 172.31.0.105 host and send it back, as shown in:
  
If the value of time is greater than 0, the network settings are basically correct. If the value of time is-1, the network settings are incorrect.
  
Then, you can use telnet, ftp, and other programs to test.
  
Section 2 file system, user, and user interface management
  
I. file system and user management
  
For file system and user management, the RedHat system provides an integrated management program Linuxconf, it can be divided into character interface mode, graphic interface mode, and web interface management mode (the experiment system management will be further introduced later ). It not only processes file systems and user management, but also processes network device loading and startup program settings. You can use linuxconf to call it. it automatically determines whether the current x-windows graphic environment is used, and then calls the corresponding program, as shown in the following figure:
  
In this integrated management program, we can perform initialization settings, add the experiment user group IT, add the experiment management account and the experiment user account (user1 ~ User50); set disk quota management.
  
1. disk quota settings
  
In File system settings, disk quota management is very important. For this experiment system, the hard disk space of the system is available to many students. Therefore, each student must allocate a disk quota during the experiment. Fortunately, the Linux system provides quota to set the disk quota. in this way, the experiment user account is allocated the corresponding disk space. if the disk space exceeds a certain amount, an alarm is triggered. then, a certain amount of data is prohibited from uploading files. In this way, combined with the experiment administrator, the system will not stop working because of disk space consumption.
  
The following are specific settings (the minimum warning line for each user is 5 MB and the elastic space is 2 MB ):
  
Use the quota, quotaon, and quotaoff commands to manage quotas.
  
The hard disk quota limits the total quantity of hard disks. We can use GID
  
You can also set limits for a single user. The following commands are used to manage the disk quota:
  
Quota -- generate a hard disk quota report
  
Quotaon -- enable hard disk quota for users and set hard disk quota
  
Quotaoff -- disable hard disk quota for users
  
Repquot -- also generate a report on hard disk quota
  
Edquota -- edit and adjust the user quota
  
Quotacheck -- check the quota usage of the file system
  
First, log on as root and edit the file system table/etc/fstab. because the experiment system needs to manage the disk quota for/dev/had, therefore, we need to modify its options. the entire file is as follows:
  
/Dev/hda1/ext2 defaults 1 1
  
/Dev/hda5/user ext2 exec, dev, suid, rw, usrquota, kgquota 1 2
  
/Dev/hda6 swap defaults 0 0
  
/Dev/fd0/mnt/floppy auto sync, user, noauto, nosuid, nodev, unhide 0 0
  
/Dev/cdrom/mnt/cdrom auto user, noauto, nosuid, exec, nodev, ro 0 0
  
None/proc defaults 0 0
  
Next, we generate a file named quota. user and a file named quota. group under/user, and set their permissions to 600. Run the touch and chmod commands as follows:
  
# Touch/user/quota. user
  
# Chmod 600/etc/quota. user
  
# Touch/user/quota. group
  
# Chmod 600/etc/quota. group
  
Now, restart the computer and the system's quota will start to work.
  
Next, we use edquota? U username sets the disk quota for user username as follows (for user user1 ):
  
# Edquota? U user1
  
Edquota will call an editor to read/user/quota. user. let's edit it as follows:
  
The first soft parameter is the minimum number of alerts for the hard disk (by KB), the first hard parameter is the maximum allocation amount for the hard disk (by KB), and the second soft parameter is the minimum number of alerts for the number of files, the second hard parameter is the maximum number of files.
  
Now, we need to set the pre-warning period for user1. the default period is one week (7 days). Obviously, this time is too long. We will set it to 5 minutes, so that the excess users can be alerted during the experiment period. Use edquota (or user user1) as follows ):
  
# Edquota? T user1
  
The edquota operation is still performed on/user/quota. user. we can set it in the corresponding location, as shown below:
  
Finally, check whether the user's quota is correct. use the quota command to check the user's disk quota.
  
Set with Linuxconf
  
Set/dev/hda5 as a quota disk
  
Access local drvice à/dev/hda5 double-click to set:
  
And enable the user quota enabled and group quota enabled:
  
Then, set the Disk quota for each user, set the minimum amount of warning Disk in Disk space soft limt, and set the maximum amount of Disk in Disk space hard limit, set the warning time in Disk space grace period, set the lowest number of Files in Files soft limit, and set the maximum number of Files in Files hard limit, set the warning time in Files grace period:
  
Actual test
  
Log on to the system using an account with disk quota, and copy some large files (more than 7 MB) to see if the system has warning information that does not allow users to upload files again. Is the warning message for exceeding the disk quota in shell:
  
In addition, if you use Ftp to upload a large number of files for testing, the system rejects users from uploading files after the amount is exceeded.
  
2. user interface management
  
Because our system is an experimental system, it is necessary to make some changes to the user's interactive interface and add some necessary prompts to facilitate the experiment.
  
1. telnet logon interface settings
  
Change/etc/rc. local and comment out the corresponding issue.net statements. As follows:
  
# Echo "">/etc/issue.net
  
# Echo "Linux Mandrake $ R">/etc/issue.net
  
  

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.