Operating System - Linux
1829447 Members
1192 Online
109992 Solutions
New Discussion

different IP's on diff places

 
SOLVED
Go to solution
Donald Kok
Respected Contributor

different IP's on diff places

Hi,

I have a notebook with RH8. I work on it on different locations. Sometimes I need to get a ip from dhcp, sometimes I need a fixed IP.

Is there a way to automate this. Or semi-automate it, with some icons on my desktop?

Thanks in Advance
Donald
My systems are 100% Murphy Compliant. Guaranteed!!!
4 REPLIES 4
Balaji N
Honored Contributor
Solution

Re: different IP's on diff places

hi donald,
how about adding a shortcut to redhat-config-network on your desktop :-)

also, read the following page in your box for some info.
/usr/share/redhat-config-network/help/network-profiles.html


hth
-balaji
ps: can u please post back ur results.
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Dan Wanek
Valued Contributor

Re: different IP's on diff places

Try netenv. It allows you to select different networking options at boot from an ncurses interface. The source and RPMs are available here:

http://netenv.sourceforge.net/

--
Dan
Stuart Browne
Honored Contributor

Re: different IP's on diff places

Dan, that wouldn't work. The IP configuration isn't done from there. That's for 'Network Services'.

What Balaji said is the 'manual' way to chagne these settings.

To have it done by some 'icons', you could create a small script (or two) of which did the work manually.

Simply put, the difference between a Statically assigned IP and a DHCP assigned IP (configuration wise) in RH is one argument to one variable in one file.

/etc/sysconfig/network-scripts/ifcfg-eth0

The line 'BOOTPROTO' takes two values (in reality). The two are:

BOOTPROTO=static

or

BOOTPROTO=dhcp

All of the other settings can change, just this *one* needs to change. After changing this value, just 'ifdown eth0;ifup eth0' is sufficient for the new settings to take place.

So it now depends on how 'automated' you want this to be. The simplest scripted way would be to have a 'dhcp' version and a 'static' version of the file, and a small script which changes a symobolic link to the appropriate one.

A more complex routine could check what the current setting is and use 'ex' to change it in place.

If you need help setting these finer points up, just post back.

Hope this helps, or gives you a better idea of what direction to head.
One long-haired git at your service...
Balaji N
Honored Contributor

Re: different IP's on diff places

this thread is a bit old, but was going thro a review of RHL 9.0 and saw that there is a solution for ur fix. thought would post here hence.

++++++++++++++++++++++++++++++
The ifup command and profiles

A little known fact is that newer versions of RHL support multiple network profiles. This is useful for machines that commonly plug into different networks (think laptops). The easy way to create network profiles is to use the redhat-config-network command. The question then becomes, what happens when you type "ifup eth0"? The behavior wasn't defined in previous versions, however, now in RHL 9 the following behavior is defined;

search path for:# ifup $DEVis:/etc/sysconfig/networking/profiles/$CURRENT_PROFILE/ifcfg-$DEV/etc/sysconfig/networking/profiles/default/ifcfg-$DEV/etc/sysconfig/network-scripts/ifcfg-$DEV
A cool trick is to boot your RHL box directly into a profile from the GRUB boot screen. To do this, create a separate /etc/boot/grub.conf entry for each network profile, and in each entry add the kernel argument netprofile=profilename.
++++++++++++++++++++++++++++++

and for those interested in the full review read it below. a good article for sys admins.
http://www.gurulabs.com/RedHatLinux9-review.html

any1 tried rhl9 already?

-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.