LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-07-2010, 06:47 AM   #1
IanVaughan
Member
 
Registered: Jun 2009
Location: Brighton, UK
Posts: 50

Rep: Reputation: 16
Get IP from DHCP if exists, if not then set to <THIS_IP>


I have my network getting their IP's via the DHCP server.
But when they get unpluged/moved, I need them to set themselfs a known static IP.

How can this be done?


RHELv5
Code:
cat /etc/sysconfig/networking/profiles/default/ifcfg-eth0
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:1c:25:d3:5b:ff
ONBOOT=yes
TYPE=Ethernet
#IPADDR=192.168.109.2
 
Old 05-07-2010, 07:42 AM   #2
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 51
It should be something to do with dhclient, try looking here:
Code:
man dhclient.conf
This is what you want your dhclient.conf file to be called...
Code:
/etc/dhclient-${DEVICE}.conf

Last edited by SuperJediWombat!; 05-07-2010 at 07:46 AM.
 
Old 05-07-2010, 08:28 AM   #3
SuperJediWombat!
Member
 
Registered: Apr 2009
Location: Perth, Australia
Distribution: Ubuntu/CentOS
Posts: 208

Rep: Reputation: 51
Try this:
Code:
alias {
  interface "eth0";
  fixed-address 192.168.2.2;
  option subnet-mask 255.255.255.0;
  option routers 192.168.2.250;
  option domain-name-servers 192.168.2.250;
}
If you are using network-manager, it may stop this from working.
 
  


Reply



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 tell whether IP is set as static or DHCP? loadedmind Fedora 6 11-09-2006 11:08 PM
How to set up DHCP on Slackware? KaZiber Linux - Networking 5 02-05-2005 07:53 AM
SIOCADDRT: File exists SIOCCADDRT: File Exists Failed to bring up eth0. opsraja Linux - Networking 0 01-10-2005 08:29 AM
Set up DHCP gigglesnorter Linux - Networking 1 09-13-2004 11:10 AM
How to Set a Internet[DHCP] gamehack Slackware 1 06-14-2003 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:42 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
Open Source Consulting | Domain Registration