Configure multiple IP addresses in linux and ip addresses in linux

Source: Internet
Author: User

Configure multiple IP addresses in linux and ip addresses in linux

The Red Hat Linux is used as an example. Assume that the original system has configured an IP Address: 192.168.0000140, the configuration file path/etc/sysconfig/network-script/ifcfg-eth0. Now you need to configure an IP address with the network segment 192.168.1.

STEP (root user permission required ):

1, cp/etc/sysconfig/network-script/ifcfg-eth0/etc/sysconfig/network-script/ifcfg-eth1

2, vi/etc/sysconfig/network-script/ifcfg-eth1 to modify the black part, colon plus 1

DEVICE = eth0: 1
BOOTPROTO = none
ONBOOT = yes
HWADDR = 00: 0c: 29: ee: a6: 11
NETMASK = 255.255.255.0
IPADDR = 192.168.1.140
TYPE = Ethernet
USERCTL = no
IPV6INIT = no
PEERDNS = yes

3. The service network restart takes effect for the modified configuration.

4. View through ifconfig. Then, you will see an additional eth1 IP configuration.


Reference: http://world77.blog.51cto.com/414605/368529



How to configure multiple IP addresses for one Nic in linux # ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up Description: up indicates immediate activation
Run the following command to configure multiple ip addresses for a single NIC:
# Ifconfig eth0: 0 192.168.0.1 netmask 255.255.255.0 up
# Ifconfig eth0: 1 192.168.0.2 netmask 255.255.255.0 up
After the ping test is completed, the rebootip address is changed when multiple ip addresses are configured for a single Nic. To enable automatic ip address activation at startup, set the following methods:
Type:
Add the above command ifconfig to rc. local
Second:
For dual-line linux, how does one configure multiple IP addresses for NICs in linux? There is no graphical interface under linux. It's too convenient to configure the network. Ha ha, it's too convenient to get used to the problem. If you need to change it, you need to configure multiple IP addresses for a single nic. in the text console, there is netconfig and the ifconfig tool netconfig. you can only use ifconfigifconfig to use man ifconfig to view ip addresses that are commonly used to configure NICs.
# Ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
Note:
Eth0 indicates the number of NICs in sequence eth1eth *
192.168.0.1 configure the IP address of the NIC
Netmask 255.255.255.255.0 configure the subnet mask
Up indicates immediate activation.
How to configure multiple IP addresses for a single network card eth0 using the ifconfig command above the need to change the place only eth0 to check some information understand eth0 eth0: x (x0-255 example eth0: 0 or eth0: (1) eth0: x indicates the virtual network interface (eth0 ).
Run the following command to configure multiple ip addresses for a single NIC:
# Ifconfig eth0: 0 192.168.0.1 netmask 255.255.255.0 up
# Ifconfig eth0: 1 192.168.0.2 netmask 255.255.255.0 up
# Ping 192.168.0.1
# Ping 192.168.0.2
The ping test has completed the configuration of multiple ip addresses for a single Nic. reboot finds that the ip address has changed back.
All required settings automatically enable the IP address setting at startup
Type:
Add the above command ifconfig to rc. local
Second:
Name the file based on the name of the network Virtual Interface in/etc/sysconfig/network-scripts/ifcfg-eth0
Example ifcfg-eth0: 0 or ifcfg-eth0: 1 and so on
# Below to see the ifcfg-eth0: 0 file configuration information
DEVICE = eth0: 0 # Network Virtual Interface eth0: 0
ONBOOT = yes # activated at startup
BOOTPROTO = static # use a static IP Address
IPADDR = 192.168.0.1 # assign an IP address
NETMASK = 255.255.255.0 # Subnet Mask
The configuration file is similar to restarting the ping test configuration.
Today, I saw what others did not understand. I tried it before I knew what to do.
How can I disable an ip address?
# Ifconfig eth * [: x] down (* indicates the NIC number x indicates the Virtual Interface number 0-255)
View ip configuration information:
# Ifconfig
Detailed source reference: http://www.jb51.net/LINUXjishu/10935.html

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.