LinuxQuestions.org
Review your favorite Linux distribution.
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 07-14-2009, 02:59 PM   #1
hamzas
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Rep: Reputation: 0
Main IP address of the system


Hello folks,

My first post here, please be gentle

I have a VPS running Debian and it has a few IP addresses assigned to it. When I reach a web site or another machine, it seems to use the first IP address tied to the first NIC.

Is there any eay I can change this? (I can't really swap the IP addresses of the interfaces because they get set automatically everytime I reboot the VPS)


Thanks!
 
Old 07-14-2009, 03:09 PM   #2
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
If you can use a static IP, just do that. On Debian systems this amounts to editing /etc/network/interfaces. Fedora/RH systems use /etc/sysconfig/network. The syntax is different.

If you want to continue to use DHCP on the interfaces, then you can "request" an IP for each from the DHCP server. To do this, modify /etc/dhcp3/dhclient.conf or equivalent to include yoru own lease configuration:

Code:
lease {
  interface "eth0";
  fixed-address 192.168.1.120;
 # .. your other options ...
}
Hope this is enough to get you going!
 
Old 07-14-2009, 03:55 PM   #3
hamzas
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jhwilliams View Post
If you can use a static IP, just do that. On Debian systems this amounts to editing /etc/network/interfaces. Fedora/RH systems use /etc/sysconfig/network. The syntax is different.

If you want to continue to use DHCP on the interfaces, then you can "request" an IP for each from the DHCP server. To do this, modify /etc/dhcp3/dhclient.conf or equivalent to include yoru own lease configuration:

<snip>

Hope this is enough to get you going!
Hello Jameson,

Thanks for your prompt reply. The IP addresses are all static, the only problem is all the changes I make to the network configuration scripts get wiped out every time the VPS reboots. I think the VPS 'supervisor' recreates these files when the machine powers up.

I guess asking the hosting company to change the order of the IPs might be the best solution as I can't seem to modify the network scripts... unless there is another 'hack' I can use


Thanks!
 
Old 07-14-2009, 04:15 PM   #4
jhwilliams
Senior Member
 
Registered: Apr 2007
Location: Portland, OR
Distribution: Debian, Android, LFS
Posts: 1,168

Rep: Reputation: 210Reputation: 210Reputation: 210
You could write an init.d script to override the automatic network settings? Unless all of /etc gets reset... (Yuck!)
 
Old 07-14-2009, 05:17 PM   #5
hamzas
LQ Newbie
 
Registered: Jul 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jhwilliams View Post
You could write an init.d script to override the automatic network settings? Unless all of /etc gets reset... (Yuck!)
I haven't thought of that before!

It seems like only the network scripts get overwritten so I suppose I can do that


Thanks Jameson!
 
  


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
In the main memory (RAM), how the data & address are stored? rajeshcurl Programming 8 05-21-2009 07:08 PM
Access address out of main memory tsik Programming 3 01-17-2007 06:07 AM
Move Main System from RAM to swap timothyb89 Linux - General 10 08-26-2006 03:49 PM
what does system does before start executing main() vkmgeek Programming 1 06-19-2006 06:36 AM
When will Linux be the main operating system of most computers? darin3200 General 21 03-25-2003 05:05 PM


All times are GMT -5. The time now is 09:30 PM.

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