Solved

adding ip on centos

Posted on 2011-09-02
8
491 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 78

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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 78

Expert Comment

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

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Suggested Solutions

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

713 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