LINUX basic network parameters

Source: Internet
Author: User
Tags fully qualified domain name
Basic LINUX network parameters-general Linux technology-Linux technology and application information. For more information, see the following section. Author: Lightning cto

Basic configuration file
1./etc/hosts
/Etc/hosts is a simple text file that associates IP addresses with host names. Each computer in a TCP/IP network must have an IP address that identifies it. In the Hosts file, you can associate the host name with the IP address so that you can use this name when accessing the computer without entering a long string of IP addresses. Each item in/etc/hosts contains an IP address, blank space, host name, And alias. # Indicates that the comment starts. The content format is roughly as follows:
192.168.0.2 linpxl.lintec.edu.cn linpcl
In this Hosts file, the IP address 192.168.0.2 maps to host .linpcl.lintec.edu.cn and assigns it a backup Host Name (or alias) linpcl. On the local machine, you can use these two names to access the machine whose IP address is 192.168.0.2.
2./etc/services
The relationship between the port number and the standard service is defined in RFC17.Assigned Munbers. Using the/etc/services file, the server and client programs can convert the service name to the port number. This table exists on each host. Only the root user has the permission to modify this file. In general cases, this file does not need to be modified because it already contains the port number corresponding to common services. Below are the lines in the default/etc/serviced RedHat installation:
Ssh 22/udp
Telnet 23/tcp
Telnet 23/udp
#24? Private mail system
Smtp 25/tcp mail
The leftmost column is the host service name, the middle column is the port number, and "/" is followed by the port type, which can be TCP or UDP. All the columns that follow are the aliases of the previous service. This alias also exists in this file, which appears after the port number. In the preceding example, mail is the alias of the smtp service.
3./etc/sysconfig/network
/Etc/sysconfig/network is used to specify the desired network configuration information. There are several scripts to use during boot. This file can contain one or more of the following keywords/value pairs:
"NETWORKING = YES/NO: YES indicates network needs to be configured: NO indicates NO network needs to be configured
"HOSTNAME = hostname: Fully Qualified Domain Name of the host;
"GATEWAY = gw-ip; ip address of the Network GATEWAY;
"GATWAYDEV = gw-dev: gateway device name (such as eth0 or IP address );
"NISDOMAIN = dom-mame: indicates the NIS domain (if any ).
The following is an example of the minimum configuration of/etc/sysconfig/network:
[Rout @ linpcl root] # cat/etc/sysconfig/network
NETWORKING = yes
HOSTNAME = loxalhost. loaldomain

Executable scripts and commands
1./etc/rc. d/init. d/network {start | stop | restart | reload | status}
/Etc/rc. d/init. d/network is the initialization script program at system startup. When the system starts at a running level, it initializes all configured network interfaces. When the script program is running, it mainly calls the relevant script programs under the/etc/sysconfig/network-scritps/directory to work.
2./etc/sysconfig/metwork-scripts/ifup And/etc/sysconfig/network-scripts/ifdown
In fact, ifup and ifdown are symbolic links pointing to/sbin/ifup and/sbin/ifdown respectively. These two scripts are called by the/etc/init. d/network STARTUP script to start and stop network interfaces, and they call all other scripts in the directory as needed.
Ifup and ifdown usually only contain one parameter, that is, the device name (such as eth0 ). The system is in the boot process. Use the boot parameter to call them, so that the device is not activated and configured to be initialized at system startup (that is, ONBOOT = no in the/etc/sysconfig/networking/device/ifcfg-interface-name configuration file) ).
3. ifconfig
The Ifconfig command is used to set or read network device parameters in the system kernel table to provide information for Linux network running. Ifconfig displays, activates, and disables network devices of the system, and displays, adds, and deletes network device addresses and statuses.
(1) Ifconfig syntax parameters are as follows:
"Interface: network interface, such as eth
"Add: Set the IPV6 address of the network device
"Del <地址> : Delete IPV6 addresses of network devices
Down: Disable a specified network device
Up: Start a specified network device
"Hw : Set the network device type and hardware address. HW indicates the hardware type.
Io_addr: Set the I/O address of the network device.
"Irq: Set the IRQ of the network device
"Netmask: Set the subnet mask of the network device
(2) Use the ifconfig command to view network interface information.

You can use the ifconfig command without parameters to obtain information about the network devices activated by the system. The symbol information in the table is:
Eth0: indicates the NIC code
"Lo: indicates the network delivery address in Linux. Linux uses this address to simulate network behavior and supports local virtual network operations.
HWsddr: hardware address of the network card.
Inet addr: IP address of the network card.
"Bcast: broadcast address.
"Mask: Subnet Mask.
(1) Activate a network device:
[Root @ linpcl root] # ifconfig eth0 up
(4) change the address of the network device:
[Root @ linpcl root] # ifconfig eth0 192.168.0.2 netmask 255.255.255.0
(5) disable the network device:
[Root @ linpcl root] # ifconfig eth0 down
4. Metconfig Network Device Configuration Tool
Netconfig is a special network configuration tool for Rer Hat Linux. It provides intelligent network device settings on the console interface. You can complete Nic settings step by step according to the prompts of this tool, it is convenient for general appliances. The operation is performed step by step according to the interface prompts.
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.