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

Server: add IP to network card in batch under Centos system

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Server: add IP to network card in batch under Centos system

Add IP to the network card one by one under the Centos system

Create similar ifcfg-eth0:x files under / etc/sysconfig/network-scripts/, for example:

DEVICE=eth0:0

ONBOOT=yes

BOOTPROTO=static

IPADDR=192.168.1.100

NETMASK=255.255.255.0

NETWORK=192.168.1.1

BROADCAST=192.168.0.255

TYPE=Ethernet

Batch method can be used if it is a large number of continuous IP.

1. Establish / etc/sysconfig/network-scripts/ifcfg-eth0-range0

two。 Add the following to ifcfg-eth0-range0:

DEVICE=eth0

ONBOOT=yes

BOOTPROTO=static

IPADDR_START=192.168.1.100

IPADDR_END=192.168.1.200

CLONENUM_START=0

GATEWAY= Gateway address

NETMASK= subnet mask

NO_ALIASROUTING=yes

The above content will add the IP range segment from IPADDR_START (192.168.1.100) to IPADDR_END (192.168.1.200). The value of CLONENUM_START is the network card of the previous IP alias. You can view the number after the last eth0: by ifconfig. The above example is the corresponding eth0:0.

To add multiple IP range, just set up ifcfg-eth0-range1, ifcfg-eth0-range2 in sequence.

Restarting the network after modification is complete:

/ sbin/service network restart

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