Set multiple IP addresses for the NIC under RHEL5

Source: Internet
Author: User
Set multiple IP addresses for NICs under RHEL5 in Linux. to solve some network access problems, you sometimes need to configure multiple IP addresses for one nic. in some documents, this is called AddsaliasesforDevice !. The following are some common configuration options for common Ethernet network interfaces :... in Linux, you can set multiple IP addresses for NICs under RHEL5. to solve some network access problems, you sometimes need to configure multiple IP addresses for one nic. in some documents, it is called "Adds aliases for Device! ". The following are common configuration options for common Ethernet NICs: www.2cto.com DEVICE = eth0 # define the name of the physical DEVICE. ONBOOT = yes # optional yes, no, whether to activate the NIC at startup. BOOTPROTO = static # protocol type, which can be static, dhcp, bootp, or none. HWADDR = 00: 12: 34: 56: 78: AB # MAC.
IPADDR = 192.168.1.2 # set network IP address NETMASK = 255.255.255.0 # set subnet mask GATEWAY = 192.168.1.1 # set gateway broadcast = 192.168.1.255 # set BROADCAST address USERCTL = no # optional yes, no, allow non-root users to control the device TYPE = Ethernet # set the Nic TYPE
You can configure multiple IP addresses in either of the following two scenarios: one is to configure a few additional IP addresses, for example, adding an IP address to a host; second, you can add multiple IP addresses at a time to retain multiple IP addresses in batches in a specific CIDR block. Next, we will briefly analyze the configuration process of these two cases. Www.2cto.com is applicable to the first scenario. assume that an IP address, such as 192.168.1.3 and subnet mask, is added based on the preceding configuration. The configuration steps are as follows. first, generate a copy of the corresponding configuration file. when using the cp command, it is best to add the "-a" parameter to keep the attributes of the original file to avoid permission and other factors, as a result, the network cannot be started in subsequent configurations. The command is as follows: # cd/etc/sysconfig/network-scripts/# cp-a ifcfg-eth0 ifcfg-eth0: 1 and then use the vim editor to open the ifcfg-eth0: 1 file, refer to the options above. In the new ifcfg-eth0: 1 file, you only need to retain the following: DEVICE = eth0 IPADDR = 192.168.1.3 NETMASK = 255.255.255.0 other options that can be obtained from the master configuration file. In the second scenario, we assume that you need to add 192.168.2.1 to a cross-network segment ~~ 192.168.2.100, a total of 100 IP addresses, subnet mask is 255.255.255.0, the steps are as follows: # cd/etc/sysconfig/network-scripts/# cp-a ifcfg-eth0 ifcfg-eth0-range0 and then modify the ifcfg-eth0-range0 file, in this file, you need to make the following changes: DEVICE = eth0 IPADDR_START = 192.168.2.1 # set the start IP address of the CIDR block IPADDR_END = 192.168.2.100 # set the end IP address of the CIDR block NETMASK = 255.255.255.255.0 CLONENUM_START = "20" # set Virtual Interface (CLONE) starting from "number" # In this example, it will start from 20, 23 ...... NO_ALIASROUTING = yes # This option can be set in the master configuration file (ifcfg-eth0) # The virtual interface can inherit the settings in the master configuration file, its role is to avoid the virtual interface in the new definition of routing information, this causes slow route access. Of course, it can also be defined according to actual needs.
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.