In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to configure multiple IP for the next network card of linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "linux next network card how to configure multiple IP" bar!
Linux next network card how to configure multiple IP?linux below if there is no graphical interface to configure the network is really not too convenient, ha ha, habit problems, of course, habits need to change, recently encountered a problem requires a single network card to configure multiple ip addresses. There are netconfig and ifconfig tools under the text console. Netconfig is a little more convenient graphically, but without documentation, configuring an ip can cope with it, but if you configure multiple IP, you can't handle it. You can only use the usage of ifconfig,ifconfig to view it using man ifconfig. The most commonly used command for configuring ip to the network card is
# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
Description:
Eth0 is the first network card, followed by eth2,eth*
192.168.0.1 is the ip address of the first network card configured for the network card.
Netmask 255.255.255.0 is configured with a subnet mask
Up means to activate immediately.
How to configure multiple ip addresses for a single network card eth0? if you use the ifconfig command, the only thing that needs to be changed above is eth0. After looking up some information, you can see that changing eth0 to eth0:x (x is 0Muth255 such as eth0:0 or eth0:1, etc.), eth0:x is called virtual network interface, which is based on network excuse (eth0).
So the way to configure multiple ip for a single Nic is to use the command:
# 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
After passing the ping test, the function of configuring multi-ip with a single network card is completed. Reboot later found that the ip address had changed back.
Therefore, the ip setting must be set to activate automatically at startup.
The first kind:
Add the above command ifconfig to rc.local
The second kind:
It is modelled on / etc/sysconfig/network-scripts/ifcfg-eth0 to add a file named according to the name of the network virtual interface.
Such as ifcfg-eth0:0 or ifcfg-eth0:1 and so on.
# Let's take a look at the configuration information in the ifcfg-eth0:0 file
DEVICE=eth0:0 # Network Virtual Interface eth0:0
Activate when ONBOOT=yes # starts
BOOTPROTO=static # uses static ip addresses
IPADDR=192.168.0.1 # assigning ip addresses
NETMASK=255.255.255.0 # Subnet Mask
Other configuration files are similar. Restart the ping test and the configuration is successful.
Today, I didn't understand how to do it until I tried.
How to turn off an ip? use the
# ifconfig eth* [: X] down (* represents the network card number, and x represents the virtual interface number 0Mui 255)
View ip configuration information:
# ifconfig
At this point, I believe you have a deeper understanding of "linux next network card how to configure multiple IP". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.