Get the App
SLTechnology News&Howtos  ›  Servers  › 

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

Shulou Source: shulou.com Published: 2022-06-03 06:07:35 09月14日 Update

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!

Tags: Network card network different file configuration information content form interface more target service output utility for this business two company available in command Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux OPPO Reno NVidia macOS