LinuxQuestions.org
Visit Jeremy's Blog.
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 06-22-2005, 04:08 PM   #1
Psibur
LQ Newbie
 
Registered: Jul 2004
Location: . <-- You Are Here
Distribution: Slackware 2.4.30
Posts: 20

Rep: Reputation: 0
How Do I Switch From Static IP To DHCP


Running Slackware (10.1 if that makes much diff). I've always had a static IP for my Slack boxes but I need to switch them to use DHCP. What do I have to do to switch from static IP to DHCP (and back)?

I have a feeling I have to start in /etc/rc.d but not quite sure. I also think I cought something that dhcpcd is my friend here, but haven't been formally introduced.

Much thanks in advance...
 
Old 06-22-2005, 05:05 PM   #2
Bebo
Member
 
Registered: Jul 2003
Location: Göteborg
Distribution: Arch Linux (current)
Posts: 553

Rep: Reputation: 31
You're right in that the solution lies in /etc/rc.d However, you don't have to fiddle around with dhcpcd directly. dhcpcd will be called from /etc/rc.d/rc.inet1, which is configured in /etc/rc.d/rc.inet1.conf.

You can configure your IP address settings directly in etc/rc.d/rc.inet1.conf. If you do this, you have to change the appropriate instance of USE_DHCP[n]="" to USE_DHCP[n]="yes", where n is the number corresponding to the NIC which connects to the DHCP server. Meaning, if the output of ifconfig says something like
Code:
eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:335384 errors:0 dropped:0 overruns:0 frame:0
          TX packets:263564 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:393359444 (375.1 Mb)  TX bytes:26390656 (25.1 Mb)
          Interrupt:18 Base address:0xe800 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:16788 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16788 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:21083024 (20.1 Mb)  TX bytes:21083024 (20.1 Mb)
then you can see that n is 0 ("eth0").

However, I must say that I find it easier to use the command netconfig, which lets you set your IP address(es) up really easily. I'm sure you remember this from when you installed Slack.

HTH
 
Old 06-22-2005, 05:11 PM   #3
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
Welcome to LQ!

You could edit /etc/rc.d/rc.inet1.conf by hand. Or you could issue "netconfig" as root.

The Revised Slackware Book Project is a good reference. In it the netconfig program is
mentioned, but it's still suggested that we review the configuration ourselves and learn
how this works. I think it's easy, and nice to understand what's happening behind that
user interface.
 
Old 06-23-2005, 09:40 AM   #4
Psibur
LQ Newbie
 
Registered: Jul 2004
Location: . <-- You Are Here
Distribution: Slackware 2.4.30
Posts: 20

Original Poster
Rep: Reputation: 0
Talking

Much thanks for all the info guys. I'll definatly pass it on.

Chinaman: You're right, the book is quite good. Reading it fervently.
 
  


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
Unable to switch from DHCP to Static IP with Slackware 10.1 dmkh Linux - Networking 9 09-15-2005 03:41 AM
Switch DHCP to STATIC zaicheke Linux - Newbie 2 09-14-2004 09:12 PM
Switch DHCP to static Darkangel90 Linux - Networking 1 03-29-2004 05:15 AM
switch RH 7.2 from DHCP over to static IP dwichman Linux - Networking 3 03-04-2002 01:28 AM
Switch from static IP to dhcp ? Fuel Linux - Networking 2 02-23-2002 09:21 PM

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

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

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