Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Linux bind different segments of consecutive IP to the Nic?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Today, the editor will bring you an article about Linux binding different segments of continuous IP to the network card. The editor thinks it is very practical, so I will share it for you as a reference. Let's follow the editor and have a look.

The business scenario is as follows:

A company has purchased two different IP segments, each with five consecutive IP segments, and now needs to bind to a network card on the server.

The two segments of IP are: 107.151.1434mm 107.151.143.8, 162.221.197.66mm 162.221.197.70

The specific operations are as follows:

1. Confirm the existence of the target network card cat-n / etc/udev/rules.d/70-persistent-net.rules. Look for our target network card in the output of the command, assuming it is called eth2. 2. The configuration file of the network card eth2 is as follows: the mac address of the network card cat / etc/sysconfig/network-scripts/ifcfg-eth2 DEVICE=eth2 HWADDR=00:0C:29:26:B2:F1 / * Please fill in * / ONBOOT=yes TYPE=Ethernet 3 according to the actual situation and write the configuration file of the first paragraph of IP as follows: cat-n / etc/sysconfig/network-scripts/ifcfg-eth2-range0 DEVICE=eth2 ONBOOT=yes BOOTPROTO=static TYPE=Ethernet IPADDR_START=107.151.143.4 IPADDR_END=107.151.143.8 GATEWAY=107.151.143.1 PREFIX=29 CLONENUM_START=0 / * the starting number of the network clone interface. The visible form of the final Nic is eth2:0 * / NO_ALIASROUTING=yes 4. The configuration file for writing the second paragraph of IP is as follows: cat-n / etc/sysconfig/network-scripts/ifcfg-eth2-range1 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static TYPE=Ethernet IPADDR_START=162.221.197.66 IPADDR_END=162.221.197.70 GATEWAY=162.221.197.65 PREFIX=29 CLONENUM_START=8 / * the starting number of the network clone interface. Finally, the visible form of the network card is eth2:8 * / NO_ALIASROUTING=yes 5, restart the network service service network restart 6, and view the network information ifconfig-a. At this time, you can see the network card eth2, eth2:0 ~ eth2:5, eth2:8 ~ eth2:12 in the output information.

After reading the above, have you mastered the method of binding different segments of continuous IP to the network card by Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report