LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-13-2011, 01:08 PM   #1
S.Pole
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Rep: Reputation: 1
Changing dhcpcd to dhclient in startup scripts


I recently upgraded to a Intel i3 cpu and Intel H55 motherboard. This was from an old P4 machine that was running Slackware 13.0. The machine is a single connection to the internet through a cable modem.

I moved the hard drives over, and found that dhcpcd would not work with this board in either Slackware 13.0 or 13.1 (after updating). I tried both the Gigabit onboard Lan, an old PCI ethernet card, and installing the most recent version of dhcpcd. No luck.

Dhcpcd would negotiate the lease with my cable modem, assign an IP address. But after that the process stalled. The internet was unreachable, and no nameservers were printed in /etc/resolv.conf. Manually killing dhcpcd and entering: "dhclient -4 eth0" got me on the internet without a problem.

As this appears to be a lingering problem with dhcpcd, I am going to try to use dhclient permanently.

Has anyone else moved over to using dhclient? If you have modified your startup scripts in /etc/rc.d to use dhclient, could you please post them so I could see what approach you have taken?
 
Old 01-13-2011, 02:38 PM   #2
piratesmack
Member
 
Registered: Feb 2009
Distribution: Slackware, Arch
Posts: 519

Rep: Reputation: 142Reputation: 142
I think the easiest way would be to install the Wicd network manager from the extra folder on your Slackware media. Make sure to read /usr/doc/wicd-1.7.0/README.SLACKWARE after installing.

You can change the DHCP client in Wicd's preferences.

Last edited by piratesmack; 01-13-2011 at 02:45 PM.
 
Old 01-13-2011, 04:15 PM   #3
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Code:
mv -i /etc/rc.d/rc.inet1 /etc/rc.d/rc.inet1.bak
cat >/etc/rc.d/rc.inet1 <<EOF
#!/bin/sh
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
/sbin/dhclient -4 eth0
EOF
chmod 755 /etc/rc.d/rc.inet1
 
0 members found this post helpful.
Old 01-13-2011, 07:00 PM   #4
S.Pole
LQ Newbie
 
Registered: Mar 2009
Posts: 6

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by rg3 View Post
Code:
mv -i /etc/rc.d/rc.inet1 /etc/rc.d/rc.inet1.bak
cat >/etc/rc.d/rc.inet1 <<EOF
#!/bin/sh
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
/sbin/dhclient -4 eth0
EOF
chmod 755 /etc/rc.d/rc.inet1
Many thanks. This worked like a charm. Thanks also for the link to Wicd. I'm going to install this from /extra and play around with it tonight.

What is the status of the dhcpcd project? Is it still the main dhcp, or is it losing ground to dhclient?
 
Old 12-08-2011, 06:36 AM   #5
Theta13579
Member
 
Registered: Aug 2005
Location: Milky Way Galaxy
Distribution: Slackware
Posts: 34

Rep: Reputation: Disabled
n/m

Last edited by Theta13579; 12-08-2011 at 07:04 AM.
 
0 members found this post helpful.
Old 12-09-2011, 11:22 AM   #6
rg3
Member
 
Registered: Jul 2007
Distribution: Fedora
Posts: 527

Rep: Reputation: Disabled
Now that you revived the thread it's worth pointing out my quick&dirty hack has a small problem. When the script is called with the "stop" argument it's supposed to bring the network down and it doesn't because it only tries to bring it up. Nowadays I use a script like this:

Code:
#!/bin/sh
start()
{
        # lo
        /sbin/ip addr add 127.0.0.1/8 dev lo
        /sbin/ip link set lo up
        /sbin/ip route add 127.0.0.0/8 dev lo

        # eth0
        /sbin/dhcpcd eth0
}

stop()
{
        # eth0
        /sbin/dhcpcd -k eth0

        # lo
        /sbin/ip route del 127.0.0.0/8
        /sbin/ip link set lo down
        /sbin/ip addr del 127.0.0.1/8 dev lo
}

case "$1" in
        stop|down)
                stop
                ;;
        restart)
                stop
                start
                ;;
        *)
                start
                ;;
esac
Of course, the call to dhcpcd can be replaced with dhclient -4 or whatever.
 
1 members found this post helpful.
Old 12-09-2011, 11:50 AM   #7
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
When you see something as simple as this you have to wonder why rc.inet1 and rc.wireless and the like have to be quite so long and complicated (and even they are simple compared to some of the other distro's sysconfig scripts). When the scripts used to 'make things easy' become more complicated than the few simple commands they are replacing then I think it's time to take a look at them.

One of the things I liked about OpenBSD is its simplistic approach to configuring network interfaces via its use of /etc/hosname.$interface. I think you've just prompted me to have a go at something similar.. Thanks for posting.

Last edited by GazL; 12-09-2011 at 11:51 AM.
 
  


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
dhclient vs. dhcpcd GregLee Slackware 5 09-28-2011 03:00 AM
dhcpcd and dhclient question nimnull22 Linux - Networking 4 10-04-2009 02:41 PM
dhcpcd instead of dhclient in Mepis 3.4.3 radub MEPIS 0 04-26-2006 11:37 AM
dhclient v. dhcpcd biojayc Linux - Wireless Networking 5 04-29-2005 07:34 PM
dhcpcd + dhclient issues.. Digital_Err0r Linux - Software 1 04-04-2004 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:05 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