Linux basic network configuration

Source: Internet
Author: User
Tags fully qualified domain name
Linux basic network configuration-Linux Enterprise Application-Linux server application information. For details, refer to the following section. I. Basic Network Parameters
1. Basic configuration file
2. executable scripts and commands
3. DHCP
4. DNS

Ii. Nic Configuration
1. Nic configuration file
2. Nic configuration command

Iii. Network Connectivity
1. Simple connectivity test
2. Route settings and Management
3. Route Test
4. connection to the Internet

The Linux system is designed to have powerful network and communication functions. It supports multiple network communication protocols, including TCP/IP, ATM, IPX/SPX, X.25, Frame-relay, and AppleTalk, added the implementation of the Protocol to the Linux kernel, providing efficient network communication and processing capabilities.

I. Basic Network Parameters

Linux basic network configuration and network interface initialization are mainly controlled by a set of configuration files, executable scripts, and corresponding commands. They are collectively referred to as basic network parameters.

1. Basic configuration file
1./etc/hosts
/Etc/hosts is a simple text file that associates IP addresses with host names.
Example: 127.0.0.1 localhost. localdomain (host name) localhost (alias)
192.168.0.1 linpc1.lintec.edu.cn linpc1

2. Correspondence between the/etc/services port number and the service. With this file, the server and client programs can convert the service name to the port number.
Example: ssh 22/udp
Telnet 23/tcp
Telnet 23/udp

3./etc/sysconfig/network NIC-related configuration files
For example, NETWORKING = YES | NO: YES indicates that the network needs to be configured. NO: NO network needs to be configured.
HOSTNAME = hostname: Fully Qualified Domain Name of the host
GATEWAY = gw-ip: ip address of the Network GATEWAY
GATEWAYDEV = gw-dev: gateway device name (such as eth0 or IP address)
NISDOMAIN = dom-name: NIS (name Information Service) domain (if any)
FORWARD_IPV4 = "NO", whether to forward IPV4 When configuring the router.

4./etc/host. conf domain name resolution and conversion control file.

5. hosts IP address and Host Name

6. resolv. conf DNS domain and IP address

7. nsswitch network service Conversion

2. executable scripts and commands
1./etc/rc. d/init. d/network {start | stop | restart | reload | status} can start, restart, and other network services, this command is actually used to call the relevant script programs in the/etc/sysconfig/network-scritps/directory.
2./etc/sysconfig/network-scripts/ifup And
/Etc/sysconfig/network-scripts/ifdown: 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 ). During the boot process, the system calls them with the parameter boot, that is, ONBOOT = no in the/etc/sysconfig/networking/device/ifcfg-interface-name configuration file.

3. ifocnfig
* *** Ifconfig uses the ifconfig command to view Network Interface Information:
* *** Activate network settings:
Ifconfig eth0 up
* *** Disable the network device:
Ifconfig eth0 down
* *** Change the address of a network device:
Ifconfig eth0 10.1.1.1 netmask 255.255.255.0

4. Netconfig Network Device Configuration tool graphical configuration of network devices

3. The Dynamic Host Configuration Protocol (DHCP) service.
How can I dynamically allocate IP addresses to network interface cards in Linux ???
1. Use the Netconfig command to enable the Use dynamic IP configuration (BOOTP/DHCP ).
2. Use the-dynamic option of ifconfig to configure the network interface to receive dynamic network information distribution: ifconfig eth0-dynamic
3. Create the/etc/sysconfig/networking/devices/ifcfgeth0 file and set the value of BOOTPROTO in this file to dhcp.

4. DNS (Domain Name System)
In Linux, there are two files used to declare where the system is located to find the database for parsing the relevant name information.
1./etc/host. conf is used by libc library of version 5.
Order specifies the query Order of host names. The parameter is a comma-separated query method. multi specifies whether the host specified in the/etc/hosts file can have multiple addresses.
2./etc/nsswitch. conf is used by libc library of version 6.
In the DNS configuration, add the dns option after the hosts file line in the file, for example, ifles dns
Some programs use one of them, while others use the other. Therefore, it is necessary to configure both files correctly.
3./etc/resolv. conf
This file lists the addresses of DNS servers, which can contain up to three DNS servers.
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.