Getting Started with Linux network server configuration (i) _unix Linux

Source: Internet
Author: User
Tags domain name server nameserver

To establish a secure Linux server, you first need to understand the meaning of the configuration files that are related to the network service and how to configure them securely in the Linux environment. In a Linux system, TCP/IP networks are configured with several text files, and you may need to edit these files to complete networking, but most of these profiles can be configured with command Linuxconf (where the configuration of the network portion can be implemented through the netconf command) commands to implement. The basic TCP/IP network configuration files are described below.

*/etc/conf.modules File
This profile defines the various parameter information for modules that need to be loaded at startup. The main focus here is on the configuration of the NIC. With Linux as a gateway, Linux servers need to configure at least two network adapters. To reduce the number of problems that may occur at startup, the Linux kernel does not automatically detect multiple network adapters. For a system that does not compile the driver of the network card to the kernel but is dynamically loaded as a module, it should be configured in the "conf.modules" file if multiple network adapters need to be installed.

If the device driver is compiled as a module (kernel module): For PCI devices, the module will automatically detect all devices that have been installed on the system, and for the ISA card, you will need to provide an IO address to the module so that the module knows where to look for the card, which is provided 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=0x300,0x320

This is to say that 3c509 drivers should be loaded separately with eth0 or eth1 names (alias Eth0,eth1), and that they should be loaded with parameter io=0x300,0x320 to inform the driver where to look for the NIC, where 0x is indispensable.

For PCI cards, only the alias command is required to associate the ETHN with the appropriate driver module name, and the IO address of the PCI card will be automatically detected. For PCI cards, edit the "conf.modules" file as follows:

Alias Eth0 3c905

Alias Eth1 3c905

If the driver has been compiled into the kernel: The system starts the PCI detection program will automatically find all the relevant network cards. ISA cards can also be automatically detected, but in some cases the ISA card still needs to do the following configuration:

Add configuration information to the "/etc/lilo.conf" method by passing the startup parameter information to the kernel through the LILO program. For ISA card, edit the "lilo.conf" file to add the following:

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

Note: Do not include the start parameter in "lilo.conf", test your ISA card, and use the startup parameter if you fail.

If you use a method that passes the startup parameters, Eth0 and eth1 are set in the order in which they were 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 under the "/etc/sysconfig/network-scripts" directory, Ifcfg-eth0 contains the configuration information for the first network card, and the configuration information that contains the second network card.

The following is an example of a "/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 do so by modifying the corresponding file (IFCFG-ETHN) or by creating a new file.

Device=name name indicates the names of the physical devices

Ipaddr=addr addr represents the IP address assigned to the card

Netmask=maskmask represents a network mask

NETWORK=ADDRADDR represents the network address

Broadcast=addr addr Represents broadcast address

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

None: No need to start protocol

BOOTP: Using BOOTP protocol

DHCP: Using DHCP protocol

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

*/etc/resolv.conf file
The file is a configuration file that is used by the domain name Parser (resolver, a library that resolves IP addresses based on the hostname), as shown in the following example:

Search openarch.com

NameServer 208.164.186.1

NameServer 208.164.186.2

"Search domainname.com" means that when a host name is provided that does not include a full domain name, the domainname.com suffix is added after the host name, and "NameServer" indicates that the host specified by the address when resolving the domain name is a domain name server. The domain name servers are queried in the order in which they appear in the file. */etc/host.conf file
This file specifies how the host name is resolved. Linux uses the parser library to obtain the IP address of the host name. The following is an example of a "/etc/host.conf":

Order Bind,hosts

Multi on

Ospoof on

"Order Bind,hosts" specifies the sequence of host name queries, where DNS is used to resolve domain names before the "/etc/hosts" file (or vice versa) is queried.

"Multi on" Specifies whether the host specified in the "/etc/hosts" file can have multiple addresses, and hosts with multiple IP addresses are generally referred to as multiple-homed hosts.

"Nospoof on" means that IP address spoofing is not allowed on this server. IP spoofing is a means of attacking system security by disguising the IP address as another computer to gain the trust of other computers.

*/etc/sysconfig/network file
This file is used to specify network configuration information on the server, and here is an example:

Network=yes

Rorward_ipv4=yes

Hostname=deep.openarch.com

gareway=0.0.0.0

gatewaydev=

Whether the network=yes/no network is configured;

Forward_ipv4=yes/no whether IP forwarding is enabled

Hostname=hostname HOSTNAME represents the host name of the server

Gareway=gw-ip Gw-ip represents the IP address of a network gateway

Garewaydev=gw-dev GW-DW represents the device name of the gateway, such as: Etho, etc.

Note: In order to be compatible with older software, the "/etc/hostname" file should use the same hostname as hostname=hostname.

*/etc/hosts file
When the machine starts, before DNS can be queried, the machine needs to query some host names to match the IP address. These matching information is stored in the/etc/hosts file. In the absence of 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 host IP information, and the middle column is the host name. Any subsequent columns are aliases for that host. Once you have configured the network profile for the machine, you should restart the network for the modifications to take effect. Use 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.