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


  Search this Thread
Old 06-22-2005, 04:08 PM   #1
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
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
eth0      Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:
          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:  Mask:
          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.

Old 06-22-2005, 05:11 PM   #3
Bruce Hill
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL
Distribution: Funtoo
Posts: 6,926

Rep: Reputation: 128Reputation: 128
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
LQ Newbie
Registered: Jul 2004
Location: . <-- You Are Here
Distribution: Slackware 2.4.30
Posts: 20

Original Poster
Rep: Reputation: 0

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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 > Forums > Linux Forums > Linux - Networking

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

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration