[CentOS] unable to add IP address to eth0:0 eth0:1 etc

Fri Sep 7 13:42:02 UTC 2007
Ross S. W. Walker <rwalker at medallion.com>

From: centos-bounces at centos.org 
[mailto:centos-bounces at centos.org] On Behalf Of Ray Leventhal
> 
> Karanbir Singh wrote:
> > Ray Leventhal wrote:
> >> Hi all,
> >>
> >> I need to (quickly!grrr) update IP addresses for which a 
> given machine
> >> will answer.
> >
> > for f in 10 11 30 31 13 15 20 21 22 ; do ip addr add dev eth0
> > xx.xx.xx.${f}/24 ; done; ip addr ls; ip route ls;
> >
> > check firewall to make sure traffic is allowed in/out for those IP's
> >
> >
> Thank you very much, but please forgive my ignorance...and allow me to
> explain the entire situation.
> 
> The server I'm adding IPs to is in one /24, the ips I'm adding are in
> another /24 (which is why I specified the netmask in the 
> /sbin/ifconfig
> statement, or it'd have auto-chosen 255.255.0.0)
> I'm not sure where/when/how to execute what you've suggested.  Again,
> forgive my ignorance, but if you'd explain, I'd be grateful.

You will need to add the routes for the other subnet in your routing
table as such.

route add -net XX.XX.XX.0 netmask 255.255.255.0 eth0

I believe there is a place to add static routes in one of the startup
scripts (besides rc.local), but forget where it is, I think if you
configure ifcfg-eth0:X sub-interfaces scripts ifup will create these
routes.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.