Various Linux systems configure multiple IP methods to organize __linux

Source: Internet
Author: User
Tags debian server
How to add IP under CentOS

First, add a single IP method:
# cd/etc/sysconfig/network-scripts
# CP Ifcfg-eth0 ifcfg-eth0:0
# Nano ifcfg-eth0:0 Copy Code
Copy a eth0 file with the CP command, the new file name is eth0:0, and then edit the file with the nano. Not used to using the Nano can be used with the VI command. Edit after opening file:

device=eth0:0 #此处添加: 0, keeping the same file name, adding multiple IP increments sequentially
Onboot=yes #是否开机激活
Bootproto=static #静态IP, please enter DHCP if you need DHCP access
ipaddr=192.168.1.2 #此处修改为要添加的IP
netmask=255.255.255.0 #子网掩码根据你的实际情况作修改 Copy Code

After the file is edited, run:
/etc/init.d/network Reload Copy Code

Use Ifconfig to see if the new IP has been added.

Second, the bulk add IP:

Create a range file under/etc/sysconfig/network-scripts, or you can edit it with VI
NANO/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ETH0-RANGE0 Copy Code Device=eth0
Onboot=yes
Bootproto=static
ipaddr_start=192.168.2.2 #起始IP
ipaddr_end=192.168.2.254 #结束IP
Clonenum_start=1 #表示这段IP网卡号从eth0:1 start
netmask=255.255.255.0 Copy Code
Subnet mask setting for non-class inter-domain routing (CIDR) reference: http://www.taohost.net/tools/subnet.htm

/29 (5 usable) NETMASK = 255.255.255.248
/28 (usable) NETMASK = 255.255.255.240
/27 (usable) NETMASK = 255.255.255.224
/26 (usable) NETMASK = 255.255.255.192
/25 (usable) NETMASK = 255.255.255.128
/24 (253 usable) NETMASK = 255.255.255.0

Third, the method of configuring IP address for a new network card:

If you are IP for the second network card, edit a ifcfg-eth1 file in the/etc/sysconfig/network-scripts directory:

Device=eth1
Onboot=yes
Bootproto=static
ipaddr=192.168.0.18
netmask=255.255.255.0
gateway=192.168.0.1 Copy Code

Modify the parameters of Ipaddr,netmask and gateway.

Run:

/etc/init.d/network Reload

Use Ifconfig to see if the new IP has been added.


Linux FreeBSD Server Add IP method

Ways to add IP to FreeBSD:

Vi/etc/rc.conf

The main IP address + subnet mask
Second line and thereafter with the ' alias ' in the Config line and netmask of
255.255.255.255 and proper broadcast IP.

ALso, May is fxp0, might be sis0, rltk0, etc.
ifconfig_fxp0= "inet 10.10.10.34 netmask 255.255.255.248"
ifconfig_fxp0_alias0= "inet 10.10.10.35 netmask 255.255.255.255"
ifconfig_fxp0_alias1= "inet 10.10.10.36 netmask 255.255.255.255"
Ifconfig_fxp0_alias2= "inet 10.10.10.37 netmask 255.255.255.255"

etc..

Also You can run/stand/sysconfig
Choose Configure, networking, interfaces, then NIC card (Fxp0, RLTK, DLink,
Rl0, VNE, etc ...)


Linux Debian Server method to add IP.

The method by which the Debian server adds IP.

To add secondary IPs in Debian do:

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.