12.8.1 network configuration of Red Hat and Fedora

Source: Internet
Author: User

From: http://book.51cto.com/art/200808/87187.htm

12.8 release-specific network configuration

Chapter 2 describes in detail the guiding processes of several systems. In the following sections, we will briefly summarize several network-related tasks. The system in the example will automatically configure the loopback interface, And You absolutely do not need to modify that part of the configuration. In addition, each system is slightly different.

For the example system, there are four files available to all of them:/etc/hosts,/etc/resolv. conf,/etc/nsswitch. conf and/etc/host. conf. These files have been mentioned in the previous sections on general network configurations. In addition to the resolv. conf, there may be hosts. When you add a machine to the network, you usually do not need to modify them.

After you have made any changes to the file that can control the network configuration at the boot time, you may need to restart the system or let the network interface down and then up to ensure that the changes take effect. You can use the IFUP and ifdown commands for all the release versions we have provided.

12.8.1 network configuration of Red Hat and Fedora

Table 12.12 provides network configuration files for Red Hat and fedora.

Table 12.12 Red Hat and Fedora network configuration files

 
(Click to view the chart)

The Host Name of the machine is set in the/etc/sysconfig/network file. The file also contains several lines indicating the DNS domain name and default gateway of the machine. For example, the following is a network file on a machine, which has an Ethernet interface:

 

Interface-specific data is stored in the/etc/sysconfig/network-scripts/ifcfg-ifname file, where ifname is the name of the network interface. These configuration files allow you to set IP addresses, network masks, network numbers, and broadcast addresses for each interface. They also include a line indicating whether the interface should be "up" during system boot ".

Generally, this directory contains files for the Ethernet interface (eth0) and for the loopback interface (LO. For example:

 

And

 

Is the ifcfg-eth0 and ifcfg-Lo files on the machine redhat.toadranch.com mentioned in the network file before this section.

The system provides two scripts for interface management. IFUP and ifdown take a network interface name as the parameter and start or stop the interface specified by (down. After changing the network information in any file in the/etc/sysconfig directory, run the ifdown ifname command and then run the IFUP ifname command. It is best to restart the system to ensure that your changes do not cause any minor problems. IFUP and ifdown have no manual pages, but they are shell scripts (stored under/sbin), so you can look at their contents and learn more about what they can do.

If you need to manage all interfaces at a time, you can run the script/etc/rc. d/init. d/network. The parameters accepted by this script include start, stop, restart, and status. The script is called with the start parameter during system boot.

The system startup script can also configure static routes. At the system boot time, all the routes added to the file/etc/sysconfig/static-routes will enter the routing table. The configuration items in this file provide parameters for Route add, although the order is messy (first rather than last for the interface ).

 
(Click to view the chart)

First, specify the interface, then the routing parameters: the routing type (net or host), the target network, the network mask associated with the network, and the next hop gateway. You need to use the keyword GW. Although metric is not required for the Linux kernel, this parameter can be introduced and retained in the routing table for the routing daemon process. The above Static Routing example will get the following route command:

(click to view the large image)
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.