LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Setting up a DHCP server (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-a-dhcp-server-336525/)

MasterCephus 06-23-2005 03:16 PM

Setting up a DHCP server
 
Hey guys, I am running Fedora Core 3

I have a simple home network, with a Tivo box (wireless), XP Pro box, laptop running XP Pro (wireless), and a linux server.

I am wanting to turn off DHCP on my router and use my linux box.

What I was wondering if there was a visual tool to configure it with? I would like to have all my machines have static IP addresses, and only allow them on the network.

Anyone know of a tool that I could use, or should I just modify the conf file?

win32sux 06-23-2005 03:23 PM

Re: Setting up a DHCP server
 
Quote:

Originally posted by MasterCephus
I was wondering if there was a visual tool to configure it with?
there's webmin, but configuring a DHCP is super easy... you just need to edit the /etc/dhcpd.conf file...

chatsubo42 06-23-2005 03:51 PM

this sort of answers your question...
 
hehe...

It's not that hard to setup without a gui..

install your packages.

#file /etc/dhcpd.conf

option domain-name "your_domain.local"; //replace your_domain with your local domain name if you want..
option domain-name-servers 192.168.xxx.1;//replace the xx with your network.. 1 or 10 or 156 or what ever)
option routers 192.168.xxx.1; //the ip of your internet gateway. (prolly your router that you stopped dhcp on)
ddns-update-style interim; //if you dynamic dns or some other dns system
ignore client-updates; //forgot what tis is for LOL
default-lease-time 14400; //this is a value in seconds: when you want your leases to expire?
subnet 192.168.xxx.0 netmask 255.255.255.0 { //again xxx is last octet of your subnet
option routers 192.168.xxx.1; //this could be a router defined for each subnet...
//you don't need it if you have a default one above
option subnet-mask 255.255.255.0; //subnet mask for you new network
option domain-name-servers 192.168.xxx.1; //what ever your name servers are..
//get them from resolve.conf on a working machine.
option ip-forwarding off; //hehe forgot what this was for too.. LOL
range 192.168.xxx.100 192.168.xxx.150; //this defines your ip scope. (in this case 100 to 150)
//from what ip to what ip will your machine give out?
default-lease-time 21600; //again lease data specific to this subnet
max-lease-time 43200;
}

if you have 2 interfaces you want to specify starting this only on the interface you want it to run on.. (You don't want to broadcase dhcp services to the internet. So figure out which interface is you LAN and which is WAN)
You can start dhcpd by just calling it with the command "dhcpd eth0" (to start the daemon listening on eth0) or with the "/etc/rc.d/init.d/dhcpd start" if you installed it with the redhat packages. (course could just start it and firewall the WAN port but thats a hole nother thread LOL)

*** but if you are into the GUI thing I don't think redhat is your d-stro ( most of their tools are pretty weak compared to Suse [Just My Opinion Don't flame me ... ;P] )

Suse 9.2 or .3 has a fantastic GUI for DHCP (and apache, dns, and everything else under the sun. 9.3 is better IMHO)

MasterCephus 06-23-2005 05:26 PM

Thanks guys!

I really appreciate your help!

MasterCephus 06-25-2005 10:27 AM

one more question...

what if I have a couple of machines that I want to have certain IPs.

Say I want:

linux box to be 192.168.1.100
Desktop XP Pro to be 192.168.1.101
Tivo machine to be: 192.168.1.102

etc.


How would I express that in the .conf file?

win32sux 06-25-2005 10:41 AM

by using the mac address of the hosts... for example:

Code:

host linux {
  hardware ethernet xx:xx:xx:xx:xx:xx;
  fixed-address 192.168.1.100;
}

host windoze {
  hardware ethernet xx:xx:xx:xx:xx:xx;
  fixed-address 192.168.1.101;
}

host tivo {
  hardware ethernet xx:xx:xx:xx:xx:xx;
  fixed-address 192.168.1.102;
}


MasterCephus 06-25-2005 10:58 PM

I keep getting this error:
------
Wrote 0 deleted host decls to leases file.
Wrote 0 new dynamic host decls to leases file.
Wrote 0 leases to leases file.
Listening on LPF/eth0/00:b0:d0:76:99:19/192.168.1/24
Sending on LPF/eth0/00:b0:d0:76:99:19/192.168.1/24
Can't bind to dhcp address: Permission denied
Please make sure there is no other dhcp server
running and that there's no entry for dhcp or
bootp in /etc/inetd.conf. Also make sure you
are not running HP JetAdmin software, which
includes a bootp server.
-------------

I have turned off DHCP on my router (using a linksys WRT54G)...

My dhcpd.conf looks like:
---------
#file /etc/dhcpd.conf
option domain-name "elliott.local";
option domain-name-servers 192.168.1.1;
option routers 192.168.1.1;
ddns-update-style interim;
ignore client-updates;
default-lease-time 14400;
subnet 192.168.1.0 netmask 255.255.255.0 {
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.1.1;
option ip-forwarding off;
range 192.168.1.100 192.168.1.115;
default-lease-time 21600;
max-lease-time 43200;
}
host desktop {
hardware ethernet xx:xx:x:x:x:x;
fixed-address 192.168.1.102;
}
host thor {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.101;
}
----------

any ideas on why the error?

Harlin 06-25-2005 11:04 PM

Quote:

Originally posted by MasterCephus
one more question...

what if I have a couple of machines that I want to have certain IPs.

Say I want:

linux box to be 192.168.1.100
Desktop XP Pro to be 192.168.1.101
Tivo machine to be: 192.168.1.102

etc.


How would I express that in the .conf file?

Sounds like you really just need to set these separate boxes up with static IP addressing instead of dhcp.

win32sux 06-26-2005 07:30 AM

Quote:

Originally posted by MasterCephus
Can't bind to dhcp address: Permission denied
okay, time to start troubleshooting... here's a few steps you can run through:

1 - make sure there isn't anything already bound to port 67/UDP:
Code:

netstat -a | grep bootps
or maybe:
Code:

netstat -an | grep ":67"
if you DID have something it would look like this:
Code:

win32sux@darkstar:~$ netstat -a | grep bootps
udp        0      0 *:bootps                *:*                               
win32sux@darkstar:~$ netstat -an | grep ":67"
udp        0      0 0.0.0.0:67              0.0.0.0:*

2 - make sure you have a leases file created... usually you need to create an empty lease file on your own before you start dhcpd for the first time AFAIK... on slackware the file to create is /var/state/dhcp/dhcpd.leases but i'm not sure which it is on fedora... to create the file you'd do something like:
Code:

touch /var/state/dhcp/dhcpd.leases
3 - try using a simpler (known-good) dhcpd.conf just as a test to determine if their might be an issue with your current conf file:
Code:

ddns-update-style none;
subnet 192.168.1.1 netmask 255.255.255.0 {
        option routers 192.168.1.1;
        option subnet-mask 255.255.255.0;
        option domain-name "elliott.lan";
        option domain-name-servers 192.168.1.1;
        option broadcast-address 192.168.1.255;
        range 192.168.1.100 192.168.3.115;
        default-lease-time 43200;
        max-lease-time 86400;
        }

4 - consider if this might be an "selinux" issue... i've never used selinux but i know fedora includes selinux so maybe it's security features are preventing you from binding properly and must be configured accordingly... this is just a wild guess, take it with a a huge grain of salt (i don't even know if selinux does this kinda thing)...

BTW, you probably aren't missing your leases file (as you would have gotten a leases error instead AFAIK) but i left that step in there cuz it's a common thing and it might help someone else who runs into this thread...


win32sux 06-26-2005 07:41 AM

i just found some info that confirmed to me that selinux does in fact do this kinda thing, so if you are using selinux make sure you configure it to allow the dhcp daemon:
Quote:

SELinux has controls for port binding, meaning it is able to allow or deny port binding requests based on security labels.
http://www.redhat.com/docs/manuals/e...tion-0021.html


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