Solved

adding ip on centos

Posted on 2011-09-02
8
485 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
Comment Utility
Could you post the output of
ls /etc/sysconfig/network-scripts/ifcfg-eth0*
/sbin/ifconfig -a
0
 
LVL 76

Accepted Solution

by:
arnold earned 500 total points
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:XK8ER
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 38

Expert Comment

by:wesly_chen
Comment Utility
> /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
Comment Utility
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
Comment Utility
yes.
0
 
LVL 76

Expert Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
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 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.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now