Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

adding ip on centos

Posted on 2011-09-02
8
490 Views
Last Modified: 2012-05-12
hello,
I usually add extra ips to the Centos server by editing

vi /etc/sysconfig/network-scripts/ifcfg-eth0-range0

then adding

IPADDR_START=72.5.2.1
IPADDR_END=72.5.2.8
CLONENUM_START=0
NETMASK=255.255.255.0

but now i got different ips like

72.5.2.1
72.6.8.5
72.7.6.6
72.8.6.8

what do I do now?
0
Comment
Question by:XK8ER
  • 3
  • 3
  • 2
8 Comments
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36474609
Could you post the output of
ls /etc/sysconfig/network-scripts/ifcfg-eth0*
/sbin/ifconfig -a
0
 
LVL 77

Accepted Solution

by:
arnold earned 500 total points
ID: 36474674
copy ifcfg-eth0 as ifcfg-eth0:1 and add settings there
the :1 references an index which will have the IP.
Setting multiple IPs from different segments could be trouble as your example has public IPs, i.e. the path an outgoing packet may take will depend on how you configure your routing/firewall if any to make sure that a packet that came in on one IP leaves taking the same path.
(tagging)
YOu could add the entry into /etc/rc.local

/sbin/ifconfig eth0:1 72.6.8.5 netmask 255.255.255.0  metric y broadcast 72.6.8.z up

repeat the above altering the index and the IP/broadcast/metric as you see fit.
You may need to use route to add entry to the routing table to handle the traffic originating from 72.6.8.5 through the suitable gateway for this IP.

The metric will assign control which path a packet takes to the remote side.

The lower the metric, the higher the preference for this path
netstat -rn will display the routing table on the system.
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36476050
im using that command but it doesnt seem to work..

-(01:14 22 PM)-(root@alpha)-(~) $ /sbin/ifconfig eth0:1 72.6.8.5 netmask 255.255.255.0  metric y broadcast 72.6.8.z up
SIOCSIFMETRIC: Operation not supported
72.6.8.z: Unknown host
-(01:14 54 PM)-(root@alpha)-(~) $  
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 1

Author Comment

by:XK8ER
ID: 36476057
what if I do this?

vi /etc/sysconfig/network-scripts/ifcfg-eth0:1

DEVICE=eth0:1
BOOTPROTO=static
HWADDR=00:30:48:5A:24:54
IPADDR=72.6.8.5
NETMASK=255.255.255.0
ONBOOT=yes

Open in new window

0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36476173
> /sbin/ifconfig eth0:1 72.6.8.5 netmask 255.255.255.0  metric y broadcast 72.6.8.z up
replace z with 255
/sbin/ifconfig eth0:1 72.6.8.5 netmask 255.255.255.0  metric y broadcast 72.6.8.255 up
0
 
LVL 1

Author Comment

by:XK8ER
ID: 36476180
I did exactly the same thing on my last post and it worked..

is that okay? I can keep doing the same thing for

vi /etc/sysconfig/network-scripts/ifcfg-eth0:1
vi /etc/sysconfig/network-scripts/ifcfg-eth0:2
vi /etc/sysconfig/network-scripts/ifcfg-eth0:3

etc..
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 36476249
yes.
0
 
LVL 77

Expert Comment

by:arnold
ID: 36476563
That's what I have outlined in comment http:#a36474674
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question