Solved

adding ip on centos

Posted on 2011-09-02
8
489 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
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

 
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why isn't object file created? 6 60
Error Message during CentOS 7 Minimal Install 3 47
how can I get powershell to show the history of commands used ? 10 56
ftp to port 21 4 43
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
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…
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.

831 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