Getting started with Linux network server configuration (1)

Source: Internet
Author: User


To create a Secure Linux server, you must first understand the meaning of the configuration files related to network services in the Linux environment and how to configure security. In Linux, the TCP/IP network is configured through several text files. You may need to edit these files to complete networking, however, most of these configuration files can be implemented through the configuration command linuxconf (the network configuration can be implemented through the netconf command. The following describes the basic TCP/IP network configuration file.

*/Etc/CONF. Modules File
This configuration file defines the parameter information of various modules that need to be loaded at startup. This article focuses on the NIC configuration. When using Linux as a gateway, a Linux server must have at least two NICs. To reduce possible problems during startup, the Linux kernel does not automatically detect multiple NICs. If you need to install multiple NICs for a system that does not compile the NIC driver into the kernel but is loaded dynamically as a module, configure the NIC in the "Conf. Modules" file.

If the device driver is compiled into a module (kernel module): for PCI devices, the module automatically detects all devices installed on the system. For ISA cards, you need to provide the IO address to the module so that the module knows where to find the card. The information is in "/etc/CONF. modules.

For example, we have two ISA bus 3c509 cards. One Io address is 0x300, and the other is 0x320. Edit the "Conf. Modules" file as follows:

Alias eth0 3c509

Alias eth1 3c509

Options 3c509 IO = 0x320, 0 x

This is a 3c509 driver.ProgramThe names of eth0 and eth1 should be loaded respectively (alias eth0 and eth1), and they should be loaded with parameters IO = 0x300 and 0x320, to notify the driver where to find the network card, of which 0x is indispensable.

For the PCI card, you only need the alias command to associate ethn with the appropriate driver module name. The IO address of the PCI Card will be automatically detected. For the PCI Card, edit the "Conf. Modules" file as follows:

Alias eth0 3c905

Alias eth1 3c905

If the driver has been compiled into the kernel, the PCI detection program at system startup will automatically find all related NICs. The ISA card can also be automatically detected. However, in some cases, the ISA card still needs to be configured as follows:

Add the configuration information in "/etc/Lilo. conf" by passing the startup parameter information to the kernel through the Lilo program. For the ISA card, edit the "Lilo. conf" file and add the following content:

Append = "Ether =" 0, 0, eth0 ether = "0, 0, eth1"

Note: Do not add the startup parameter in "Lilo. conf" to test your ISA card. If it fails, use the startup parameter.

If you use the method of passing the startup parameter, eth0 and eth1 are set according to the sequence found at startup.
*/Etc/hostname File
This file contains the Host Name of the system, including the full domain name, such as deep.openarch.com.

*/Etc/sysconfig/network-scripts/ifcfg-ethn File
In RedHat, the configuration file for the system network device is saved in the/etc/sysconfig/network-scripts directory, the ifcfg-eth0 contains the configuration information for the first Nic, the ifcfg-eth1 contains the configuration information for the second Nic.

The following is an example of the/etc/sysconfig/network-scripts/ifcfg-eth0 file:

Device = eth0

Ipaddr = 208.164.186.1

Netmask = 255.255.255.0

Network = 208.164.186.0

Broadcast = 208.164.186.255

Onboot = Yes

Bootproto = none

Userctl = No

If you want to manually modify the network address or add a new network interface to the new interface, you can modify the corresponding file (ifcfg-ethn) or create a new file.

Device = Name name indicates the name of the physical device.

Ipaddr = ADDR indicates the IP address assigned to the card

Netmask = maskmask indicates the network mask

Network = addraddr indicates the network address.

Broadcast = ADDR indicates the broadcast address.

Onboot = yes/no whether the card is activated at startup

None: no startup protocol required

BOOTP: Use the BOOTP protocol

DHCP: Use the DHCP protocol.

Userctl = yes/no whether non-root users are allowed to control the device

*/Etc/resolv. conf file
This file is a configuration file used by the domain name Parser (Resolver, a database that resolves IP addresses based on the host name), for example:

Search openarch.com

Nameserver 208.164.186.1

Nameserver 208.164.186.2

"Search domainname.com" indicates that when a host name that does not include a full domain name is provided, the suffix of domainname.com is added after the host name; "nameserver" indicates that the host specified by this address is the Domain Name Server when the domain name is resolved. The Domain Name Server is queried according to the order in which the file appears.
*/Etc/host. conf file
This file specifies how to resolve the host name. Linux uses the parser library to obtain the IP address corresponding to the host name. The following is an example of "/etc/host. conf:

Order bind, hosts

Multi on

Ospoof on

"Order bind, hosts" specifies the host name query order. Here, DNS is required to resolve the domain name and then query the "/etc/hosts" file (or the opposite ).

"Multi on" specifies whether the host specified in the "/etc/hosts" file can have multiple addresses. A host with multiple IP addresses is generally called a multi-point host.

"Nospoof on" indicates that IP address spoofing is not allowed on the server. IP spoofing is a means of attacking system security. By disguising IP addresses as other computers, you can gain the trust of other computers.

*/Etc/sysconfig/Network File
This file is used to specify the network configuration information on the server. The following is an example:

Network = Yes

Rorward_ipv4 = Yes

Hostname = deep.openarch.com

Gareway = 0.0.0.0

Gatewaydev =

Network = yes/no whether the network is configured;

Forward_ipv4 = yes/no whether IP Forwarding is enabled

Hostname = hostname indicates the Host Name of the server.

Gareway = GW-IP indicates the IP address of the Network Gateway.

Garewaydev = GW-dev GW-DW indicates the gateway device name, such as etho.

Note: to be compatible with the old software, the "/etc/hostname" file should have the same host name as hostname = hostname.

*/Etc/hosts file
When the machine starts, before the DNS can be queried, the machine needs to query the matching of some host names to IP addresses. The matching information is stored in the/etc/hosts file. Without a Domain Name Server, all network programs on the system query the file to resolve the IP address corresponding to a host name.

The following is an example of a "/etc/hosts" file:

IP address hostname alias

127.0.0.1localhostgate.openarch.com

208.164.186.1gate.openarch.com Gate

............ ............ .........

the leftmost column is the Host IP information, and the middle column is the host name. All the columns that follow are aliases of the host. Once the network configuration file of the machine is configured, restart the network for the modification to take effect. Run the following command to restart the network:/etc/rc. d/init. d/network restart
(source: Network)

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.