Click to See Complete Forum and Search --> : DHCP server, redhat 7.3???


robbs
08-02-2003, 03:20 AM
I've been trying to get DHCP server running on redhat 7.3 but no success. Ok, here's my config hopesome can help me figure out what's wrong. I got a linux box using as my router and firewall already. I'm now trying to implement a DHCP server. I'm running edhat 7.3 and installe dhcp-2.0pl5-8. I followed instructions from Redhat and no luck getting a DHCP client to connect. I tried clients in Linux, Windows 95 and windows xp. Below is the two /etc/dhcpd.conf config files I tried:

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
option domain-name-servers 209.226.175.223, 198.235.216.134;

And here's the other I tried:
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;

# option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 209.226.175.223;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.0.128 192.168.0.255;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}

mdwatts
08-02-2003, 09:38 AM
Is the dhcp server running?

ps ax

And did you restart the dhcp server after any modifications to /etc/dhcpd.conf?

homey
08-02-2003, 09:38 AM
I'm using Redhat 9 as a NAT router , dhcp and dns servers also. Here is what my dhcpd.conf looks like. Don't forget to restart the dhcpd after making changes.......

ddns-update-style interim;
ddns-updates on;
ddns-domainname "mydomain.com";
server-name "192.168.0.1";
max-lease-time 604800;
default-lease-time 604800;
subnet 192.168.0.0 netmask 255.255.255.0 {
ddns-updates on;
option domain-name-servers 192.168.0.1;
option domain-name "mydomain.com";
option broadcast-address 192.168.0.255;
option subnet-mask 255.255.255.0;
option routers 192.168.0.1;
range 192.168.0.2 192.168.0.50;
}

robbs
08-02-2003, 10:05 AM
Yes it's running, below is what I grab when I checked and I'm restarting it when I make changes

[root@reddog root]# ps -aef | grep dhcp
root 1778 1 0 09:52 ? 00:00:00 /usr/sbin/dhcpd eth0
root 1840 1797 0 10:04 pts/2 00:00:00 grep dhcp
[root@reddog root]#

mdwatts
08-02-2003, 10:44 AM
Can you ping 192.168.0.1 from the clients and is the dhcp client software running on them set for the same ip address?

homey
08-02-2003, 10:47 AM
If you are using two nics with one of them connected to the Internet and the other connected to a hub/switch >>> other computers, the nic which is connected to the local network needs to be trusted. If you are using Lokit, you can run the command: setup to bring up a GUI tool where you can set the local nic to be trusted.

buju
08-02-2003, 11:56 AM
Following the Redhat instruction, I added "DHCPDARGS=eth0" to "/etc/sysconfug/dhcpd" and I had commented the line in my firewall script which is below:

#echo -e "\n Loading optional settings."
# DHCPd - Enable the following lines if you run an INTERNAL DHCPd server
#
$IPTABLES -A INPUT -i $INTIF -p tcp --sport 68 --dport 67 -j ACCEPT
$IPTABLES -A INPUT -i $INTIF -p udp --sport 68 --dport 67 -j ACCEPT

robbs
08-02-2003, 12:24 PM
Ok, I got it working, I edited the sample file and added my configs. But it didn't work until I restarted the server. Thanks guys,Het Homey where would I get good documentation to set up a dns server. I've been looking yesterday but haven't found any good ones as yet.

homey
08-02-2003, 02:31 PM
Unfortunately, I have not been able to find any easy to use tutorials on dns soooo I just did it solo pretty much. I do like to use Webmin for setting up dhcp and dns but I check the files to make sure they look right. The important files are /etc/named.conf , /etc/named.custom and /etc/resolv.conf

A couple of things which I do which you may or may not care for..... :)
1. I delete the " . " zone
2. I setup a master zone for my domain
3. I setup a reverse zone for my domain
4. I put my ISP dns servers in /ec/named.custom as forwarders
5. I configure dhcpd.conf to us my server as the dns server

Here are the samples of my setup......

## named.conf - configuration for bind
#
# Generated automatically by redhat-config-bind, alchemist et al.
# Any changes not supported by redhat-config-bind should be put
# in /etc/named.custom
#
controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};

include "/etc/named.custom";

include "/etc/rndc.key";

zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
};


zone "mydomain.com" {
type master;
file "mydomain.com.zone";
};

__________________________________________________ __________
## named.custom - custom configuration for bind
#
# Any changes not currently supported by redhat-config-bind should be put
# in this file.
#


options {
directory "/var/named/";
forwarders {
156.100.56.10;
156.100.59.20;
120.60. 22.75;
};
};

__________________________________________________ __________
#resolv.conf
; generated by /sbin/dhclient-script
search mydomain.com
nameserver 192.168.0.1

Note: Don't forget to restart the services when you make changes...
service named restart and
service dhcpd restart

robbs
08-02-2003, 03:43 PM
Ok, thanks man, I'll check it out. I realise what was really messing my setting up, it's my firewall. I got to review it.

robbs
08-05-2003, 10:24 PM
Ok, DHCP is working fine now, problem was with firewall and I set up a DNS caching server, I also use http://ct.cc.swin.edu.au/bpalinux/ as a reference. How can I check if it's really caching names/ip addresses, I know DNS is working because I shut it down and tired accessing the net and it didn't work. Also when I ping my other machines the ip address I'm seeing is an external address, and would be able to get pc's on the network to see each other.


Roberto

homey
08-05-2003, 11:08 PM
When I set up my dns server, I also edited the /etc/resolv.conf to look like this.......
; generated by /sbin/dhclient-script
search mydomain.com
nameserver 192.168.0.1

I also added hosts ( A ) records to the dns master forward zone. Check in Webmin.

robbs
08-05-2003, 11:54 PM
I have made the change to /etc/resolv.conf, but what I realised is if I'm not connected to the internet I'm able to ping my other machines by name and it returns the correct ip address. If I'm connected though, the wrong ip addresses are returned. Also I don't understand the last part though where you mentioned adding the hosts ( A ) to the dns forward zone. I added the dns address from my isp there.

homey
08-06-2003, 12:03 AM
Sorry for the confusion. The hosts records are the name and related IP address of the client computers. That information is put in the master forward zone which you created.......
zone "mydomain.com" {
type master;
file "mydomain.com.zone";
};


How about if you check the settings from the command: neat under the dns tab.

robbs
08-06-2003, 12:14 AM
Ok, in my /etc/named.conf I had:
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};

So I should have my domain name here instead of using localhost? And also, I not using webadmin, doing everything from the shell through ssh. thx for the help, appreciate it. Gonna change the localhost and see what happens.

robbs
08-06-2003, 12:18 AM
Ok, it worked, thanks a lot man

homey
08-06-2003, 12:26 AM
I'm not sure if it matters when you leave the zone called localhost. I don't but that's just me.
I don't know how or why you are using ssh to configure the server unless it's not in front of you.
If you don't have webmin, try the command: redhat-config-bind to bring up a GUI tool for configuring dns. ( not sure if that is available in RH7.3 )

The hosts records don't show up in named.conf for some reason or another. :( But they do show up in /var/named/mydomain.com.zone

robbs
08-06-2003, 12:26 AM
Another question about this block:

zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
};

I had :

zone "0.0.127.in-addr.arpa" {
type master;
file "local.zone";
};

Is this ok?

homey
08-06-2003, 12:31 AM
zone "0.168.192.in-addr.arpa" {
type master;
file "0.168.192.in-addr.arpa.zone";
};

I don't know about any pros out there but I delete the local zones and create my own which use the IP address of 192.168.0.1 for the forward zone and 0.168.192 for the reverse zone.

robbs
08-07-2003, 09:39 AM
A question, my /etc/resolv.conf keeps getting rewritten even though I put "PEERDNS=no" in my /etc/sysconfig/network. I'm using a dsl connection, I even tried putting in "eth1" which my dsl modem uses but no luck. How can I preserve this file????

robbs
08-07-2003, 10:09 PM
Ok, I got everything working now, I fixed that problem by putting "PEERDNS=no" into my pppoe.conf file, to stop rewriting "/etc/resolv.conf".
But I noticed now that, the dhcp will only assign the old ip addresses. I change the range to one lower than the previous ones, the clients are unable to get an ip address.
My swap drive died yesterday, and my server crashed. I don't know if that's why. Have anyone experience anything similar, who can give me some advice?