Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-15-2005, 08:12 PM
|
#1
|
Member
Registered: Mar 2005
Location: Washington DC area
Posts: 214
Rep:
|
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?
|
|
|
08-16-2005, 06:25 AM
|
#2
|
Member
Registered: Oct 2004
Location: Florida
Distribution: Debian
Posts: 319
Rep:
|
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.
|
|
|
08-16-2005, 07:37 AM
|
#3
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
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.
|
|
|
08-16-2005, 02:30 PM
|
#4
|
Member
Registered: Mar 2005
Location: Washington DC area
Posts: 214
Original Poster
Rep:
|
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)
|
|
|
08-16-2005, 03:07 PM
|
#5
|
Member
Registered: Oct 2004
Location: Florida
Distribution: Debian
Posts: 319
Rep:
|
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.
|
|
|
08-16-2005, 03:53 PM
|
#6
|
Member
Registered: Mar 2005
Location: Washington DC area
Posts: 214
Original Poster
Rep:
|
where can i find the rpm with out connecting to the internet?
|
|
|
08-16-2005, 06:49 PM
|
#7
|
Member
Registered: Mar 2005
Location: Washington DC area
Posts: 214
Original Poster
Rep:
|
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?
|
|
|
08-16-2005, 07:52 PM
|
#8
|
Member
Registered: Oct 2004
Location: Florida
Distribution: Debian
Posts: 319
Rep:
|
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.
|
|
|
08-16-2005, 08:08 PM
|
#9
|
Member
Registered: Feb 2004
Posts: 140
Rep:
|
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 04:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|