LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-08-2010, 02:24 PM   #1
rasa
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Rep: Reputation: 0
How to Assign more than one IP in redhat linux


Hi,

I am using RHEL 5 or 5.5 version as my os. I want to assign more than one ip for that machine. I am very new to linux. Please guide me to do the same.


Thanks and Regards
Rasa
 
Old 01-08-2010, 02:38 PM   #2
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Hi,

The easy way to do this is to create a virtual interface/reference and assign the additional ips to them.

For CLI I use the method of copying the ifcfg-eth0 file in /etc/sysconfig/network-scripts/ the ifcfg-eth0 file should appear similar to the below copy (I have edited all networking information to private/reserved lan IPs).

Code:
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.1.255
HWADDR=xx:xx:xx:xx:xx:xx
IPADDR=192.168.1.3
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
NETWORK=255.255.1.0
ONBOOT=yes
I will call the copy something like ifcfg-eth0:1 and then opening the file you change the device to eth0:1, change the IP information as required and remove the HWADDR field as this should not be required and depending on the networking configuration other details may also not be required (I.E. Gateway). I have given a simple configuration below of the ifcfg-eth0:1 configuration, you will note the only change is the IP what has gone from a .3 to a .12.

Code:
DEVICE=eth0:1
BOOTPROTO=static
BROADCAST=192.168.1.255
IPADDR=192.168.1.12
GATEWAY=192.168.1.1
NETMASK=255.255.255.0
NETWORK=255.255.1.0
ONBOOT=yes

Last edited by r3sistance; 01-08-2010 at 02:39 PM.
 
Old 01-08-2010, 03:10 PM   #3
abefroman
Senior Member
 
Registered: Feb 2004
Location: lost+found
Distribution: CentOS
Posts: 1,367

Rep: Reputation: 55
Or have a shell script to add the ips with ifconfig when the box boots.
 
Old 01-09-2010, 12:12 AM   #4
rasa
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks to Both of you. One more question i have i made all the changes as you said and then i gave ifconfig ip (tried both ips) but it is giving the o/p as xxx.x.x.x: error fetching interface information: Device not found (xxx.x.x.x - is the ip which i have given as the parameter), i am really new to Linux admin side so i dont know whether the configuration i did is correct or not.

Please guide me to solve my issue.

Last edited by rasa; 01-09-2010 at 12:43 AM. Reason: added more info after the trial
 
Old 01-09-2010, 12:12 PM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Would you be able to copy and paste the error at all? Not really enough to go on here. I am assuming you already have one working IP here after all?
 
Old 01-10-2010, 12:40 PM   #6
rasa
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by r3sistance View Post
Would you be able to copy and paste the error at all? Not really enough to go on here. I am assuming you already have one working IP here after all?
I am getting following error

xxx.x.x.x: error fetching interface information: Device not found

Both ips are working but i am bit confused because of that error.

Last edited by rasa; 01-10-2010 at 12:41 PM. Reason: changed the wordings
 
Old 01-10-2010, 12:58 PM   #7
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Sounds strange, when does this error tend to occur if it works then?
 
Old 01-14-2010, 12:00 AM   #8
rasa
LQ Newbie
 
Registered: Sep 2009
Posts: 20

Original Poster
Rep: Reputation: 0
Sorry , i was wrong i have asked when i am givng command
ifconfig ip, it is giving some error. But i can ping both ip. But i cannot do ftp
While doing ftp secondip i am getting
Quote:
Connection closed by remote host
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to assign local ip in linux k00lit8 Linux - Newbie 7 09-17-2009 06:46 PM
REDHAT DHCP SERVER is not able to assign IP addr on a different network daemon8008 Linux - Server 1 03-25-2008 07:31 AM
Redhat 7 what file is being used to assign my multiple IPs? TooSlow Linux - Networking 3 10-24-2007 12:35 PM
Assign Drive Letter in Linux? UTKEngineer Linux - Newbie 3 10-28-2003 11:34 PM


All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration