LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Help switching from Static IP to DHCP on Redhat Linux 9 (http://www.linuxquestions.org/questions/linux-networking-3/help-switching-from-static-ip-to-dhcp-on-redhat-linux-9-a-353645/)

asilentmurmur 08-15-2005 08:12 PM

Help switching from Static IP to DHCP on Redhat Linux 9
 
Ok heres my story: I recently installed a second NIC card inside a desktop PC. I also installed Redhat Linux 9 with a minimal installation onto the desktop. I plan to use the desktop as a firewall/server. I set up eth0 as a static IP. What I want to know is , how do I switch it from static IP to DHCP so if I need to use it as DHCP i will be able to? Also, I am only running command prompt so please give me the proper commands. Also how do I switch it back to Static IP when im done with the DHCP?

RanDrake10 08-16-2005 06:25 AM

You need dhcpd installed, then use an editor (like vi) to change /etc/network/interfaces change "iface eth0 inet static" to "iface eth0 inet dhcp" and commet out the options below that line.

MensaWater 08-16-2005 07:37 AM

Actually dhcpd is a DHCP server.

You need either dhclient, dhcpcd or bump to be a DHCP client. On my Redhat and Debian I have dhclient. I just learned about the other two yesterday - apparently they are older clients.

asilentmurmur 08-16-2005 02:30 PM

and how would i use dhclient on Redhat to change my configuration from static IP to DHCP ? (also how would i do it the reverse way too)

RanDrake10 08-16-2005 03:07 PM

I meant to type "dhcpcd". Install the rpm, then change the interfaces file. To switch back to static just remove dhcp for static. It's on the install cd's or pbone.net.

asilentmurmur 08-16-2005 03:53 PM

where can i find the rpm with out connecting to the internet?

asilentmurmur 08-16-2005 06:49 PM

ok i downloaded dhcpcd and i installed it using the configure script/make/make install/make clean procedure, but now when i run the dhcpcd client, it doesnt give me any output, it just sits there running and then the command prompt comes back up. What did I do wrong? Also how do I use this thing to access the interfaces and change the network configuration to DHCP instead of Static?

RanDrake10 08-16-2005 07:52 PM

type "vi /etc/network/interfaces" to use vi editor to edit this file. In vi press " i " to insert text, then " Esc " to stop editing, and " : " then " q " to save file and quit. When done editing type "/etc/init.d/networking restart" to restart networking with dhcpcd running, or reboot.

mhiggins 08-16-2005 08:08 PM

Even a minimal install will have dhclient already installed! so you don't need to compile anything. Another note is if you do compile something it will break many RH scripts that depend on dhclient and its config files to be in specific locations. Anyway to set you interface to use dhcp run the following command as root

/usr/sbin/setup

select network configuration and select dhcp for eth0.

The other way is to edit a some config files namely :

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

make it look like this

DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
TYPE=Ethernet


-Matt


All times are GMT -5. The time now is 03:27 AM.