LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-27-2005, 03:54 AM   #1
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Rep: Reputation: 15
DHCP server on Slackware


I am attempting to set up a DHCP server on slackware 10. I have a machine with 2 nics eth0 connected to the internet and eth1 which will be connected to my local lan.

What steps do I need to take in order to configure it as a DHCP server.

From what I have read the only files that I have to edit is dhcp.conf.

At the moment this only contains a reference to my internet connection on eth0 which is a dynamic IP at the local ISP.

Any suggestions as to the steps required? or perhaps a link to a guide that is specific to slackware.?
 
Old 01-27-2005, 05:22 AM   #2
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
Edit dhcp.conf and type dhcpd to launch the dhcp server.
 
Old 01-27-2005, 07:25 AM   #3
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
maybe an example can help.
this is my simple config-file for dhcp-service on eth1 w. static ip 192.168.0.1 :

--------------------
# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0
{
range 192.168.1.100 192.168.1.200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option domain-name-servers 10.0.0.138;
option routers 192.168.1.1;

host slack22
{
hardware ethernet 00:60:97:5C:A3:71;
fixed-address 192.168.1.7;
}


}
-----------------------
lines 1-3:-->some general settings
line 4 :--> subnet declaration
line 6:-->range of adresses to give out ( there can be more than one range )
lines 7-10:--> options ( here dns adress is my dsl modem/router on eth0 ; if you have " named " running that should be 127.0.0.1 )

lines 11-15:--> example of a fixed adress for "slack22 " ( so if slack22 requests an adress it'll always get the same )

to start the dhcp-server at boot , add " /usr/sbin/dhcpd eth1 " to " rc.local "

that's it.

egag
 
Old 01-27-2005, 07:37 AM   #4
tank728
Member
 
Registered: Sep 2003
Posts: 142

Rep: Reputation: 16
I kept having a lot of trouble with dhcpd, and its config file dhcpd.conf. So
I decided to use dnsmasq, and has worked wonders. It was simple to
configure, there were many examples in the config file /etc/dnsmasq.conf.
Also another reason why I like it, is that is comes with an rc script, in
/etc/rc.d called rc.dnsmasq. Another thing, it is real easy to restrict
dnsmasq to a single nic for example eth1 your lan, as opposed to serving
ipaddress on eth0. Good Luck.

-tank
 
Old 01-27-2005, 08:41 AM   #5
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
@tank728
interesting, i learn something everyday here.
i'm running "dhcpcd" and "named" on this machine to serve one or more others.

as i read the doc and man-pages , it looks like " dnsmasq " can do the job of both.
( like also cashing dns-adresses )
is that true ?

egag
 
Old 01-27-2005, 01:52 PM   #6
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Original Poster
Rep: Reputation: 15
Thanks for the replys. The exact config of my machine is:

eth0 which is connected to my ISP on a fixed IP and
eth1 which is connected to a switch for the local lan.

- I want to enable DHCPD on the server so that it can issue IP's to the local lan.
- I want to use the server as a internet gateway for the rest of the lan.

From what I have read I have to edit 3 files rc.dhcp, rc.inet.conf and dhcpd.conf.
These files contain the following info:

rc.dhcp
--------------------------------------------------
CONFIGFILE="/etc/dhcpd.conf"
LEASEFILE="/var/state/dhcp/dhcpd.leases"
INTERFACES="eth1"
OPTIONS="-q"

rc.inet.conf
----------------------------------------------------
# Config information for eth0: (external fixed IP to internet)
IPADDR[0]="83.88.xxx.xxx"
NETMASK[0]="255.255.255.240"
USE_DHCP[0]="no"
DHCP_HOSTNAME[0]=""

# Config information for eth1: (Local LAN)
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

dhcpd.conf
------------------------------------------------------
??? ???? ???

I'm in doubt as what rc.inet.conf and dhcpd.conf should contain.

Any further help would be greatly appreciated.
 
Old 01-27-2005, 02:38 PM   #7
tank728
Member
 
Registered: Sep 2003
Posts: 142

Rep: Reputation: 16
@egag
I am not sure if dnsmasq, can cache dns addresses, but
squid can.

http://www.squid-cache.org

-tank
 
Old 01-27-2005, 04:26 PM   #8
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
thanks tank728, i'll look into that.
there are many programs for that purpose... ( that's Linux eh... )

mikz,

you have to give your eth1 a fixed ip-adress like :

-------------
# Config information for eth1: (Local LAN)
IPADDR[1]="192.168.0.1"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]="
--------------

then you can use the config i pasted above, exept for the dns-adress.
you should put the adress of your ISP there instead.
( and you can remove the "slack22 "- entry; just an example )

i guess all should work after you start dhcpd

maybe a tip : add this line to " /etc/syslog.conf " :

-----------
*.* /dev/tty8
-----------

then issue the following command ( as root ) : " #/etc/rc.d/rc.syslog restart "

now when you hit ctl-alt-F8 you can see the messages from your dhcpd-server.
( ctl-alt-F7 to get back to graph. screen )
tip from tank728 btw.

egag
 
Old 01-28-2005, 04:52 AM   #9
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Original Poster
Rep: Reputation: 15
Just to make sure that I've understood this correctly:

# dhcpd.conf
#
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;

subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255; # Where does this come from??
option domain-name-servers 10.0.0.138; # is the fixed IP of eth0 -> Internet
option routers 192.168.1.1; # is the fixed IP of eth1 -> local LAN
}
 
Old 01-28-2005, 09:54 AM   #10
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Original Poster
Rep: Reputation: 15
Now I've come a few steps closer to getting DHCP working. My dhcpd.conf now looks like this:

ddns-update-style ad-hoc;

subnet 192.168.0.0 netmask 255.255.255.128 {
range 192.168.0.11 192.168.0.50;
option routers 192.168.0.1;
option domain-name-servers 193.162.xxx.xxx, 194.239.xxx.xxx;
max-lease-time 86400000;
min-lease-time 900;
default-lease-time 864000;
}

In /etc/rc.d/rc.inet1.conf I now have:

# Config information for eth0: (external - internet)
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Config information for eth1: (Local Lan)
IPADDR[1]="192.168.0.1"
NETMASK[1]="255.255.255.128"
USE_DHCP[1]="no"
DHCP_HOSTNAME[1]=""

... and I start up at boot with
/etc/rc.d/rc.dhcpd eth1

The message that I get from dhcpd states:

Wrote 0 leases to leases file.
Listening on Socket/eth1/192.168.0.0/25
Sending on Socket/eth1/192.168.0.0/25

The only problem that I now have is connecting my workstations
(WIN 98) to the DHCP server.

From the slackware box I am unable to ping the workstation, and likewise from the workstation to the server. I've tried doing it with my firewalls down on both machines with no luck.

Am I still missing something.?
 
Old 01-28-2005, 10:03 AM   #11
win32sux
Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 371Reputation: 371Reputation: 371Reputation: 371
Quote:
Originally posted by mikz
option broadcast-address 192.168.1.255; # Where does this come from??
it's usually the very last address in the subnet...

a packet sent to this address will be "broadcast" to all addresses on the subnet...

Quote:
option domain-name-servers 10.0.0.138; # is the fixed IP of eth0 -> Internet
this is the address of the DNS server(s) you want the machines on the lan to use...

it could be the IPs of your ISP's DNS servers, or if you have a DNS daemon running on the gateway, it will be the IP address of your gateway's internal network card... i HIGHLY RECOMMEND that you use your own dns daemon on your lan instead of your ISP's... dnsmasq is the best (simple) dns daemon i've seen... it'll cache ALL dns requests and hence will speed things up dramatically... the only machine that would really need to use your ISP's DNSs would be the gateway box (external NIC)...

Quote:
option routers 192.168.1.1; # is the fixed IP of eth1 -> local LAN
yeah, this is the IP address if the gateway you want machines on the lan to use, in this case it's the IP of your gateway's internal NIC...


Last edited by win32sux; 01-28-2005 at 10:07 AM.
 
Old 01-28-2005, 11:38 AM   #12
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
-------------\
From the slackware box I am unable to ping the workstation, and likewise from the workstation to the server. I've tried doing it with my firewalls down on both machines with no luck.
\-------------

how are they connected ?

egag
 
Old 01-28-2005, 11:43 AM   #13
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Original Poster
Rep: Reputation: 15
The server eth0 is connected via a router to the internet.
The server eth1 is connected to a switch.
The workstation (Win 98) is connected to the switch.

From the workstation I ping the server 192.168.0.1 , but receive no answer.
 
Old 01-28-2005, 12:10 PM   #14
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
are the leds of those NIC's burning ?

do you have the right cables for that.
( i think, with a switch you need patch ( normal ) cables and not crossover )

egag
 
Old 01-28-2005, 12:17 PM   #15
mikz
Member
 
Registered: Sep 2004
Distribution: Slackware current
Posts: 109

Original Poster
Rep: Reputation: 15
I 'm using normal cables . The switch is lit up like a Xmas tree.
 
  


Reply


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
Gateway / DHCP Server problem on Slackware captain_bogus Linux - Networking 11 11-25-2008 01:28 PM
dhcp client not getting IP from dhcp server jkmartha Linux - Networking 2 06-17-2005 08:12 AM
how can a DHCP client get the DHCP server IP? AshesOfTime Linux - Networking 3 11-24-2004 06:50 AM
DHCP server in slackware 9.1? Blag-foo Linux - Newbie 4 09-30-2003 09:18 AM
XP Pro Build 2600/sp1 v.1105 DHCP Client to Redhat 8.0 DHCP Server - Problems atomant Linux - Networking 5 06-28-2003 11:24 AM


All times are GMT -5. The time now is 07:46 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration