Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dhcp

Status
Not open for further replies.

manek

Technical User
Apr 10, 2003
25
0
0
CZ
Hi, I have build easy net on Slackware 9.0 and everything what I did work correctly except dhcpd daemon [maybe?].

I have IP 81.27.195.17 from provider connected to switch and from switch to my server-computer on device eth0. To switch is connected my wife with IP 10.0.0.4., my server-computer provide that IP and masquerade it. My wife has win95 and IP is set up as fix IP.
Net works correctly and is setup as follows:
1. IP, netmask, gw, DNS is from my provider
ifconfig eth0 81.27.195.17 netmask 255.255.255.128 up
route add default gw 81.27.195.1
[in /etc/resolv.conf is nameserver 81.27.192.32]
2. this is my private subnet - route add -net 10.0.0.0/24 eth0
3. forwarding - echo 1 > /proc/sys/net/ipv4/ip_forward
4. masquerade - iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 81.27.195.17
5. modules for ftp transactions from my subnet
imodprobe ip_nat_ftp, modprobe ip_conntrack_ftp

This is my /etc/dhcpd.conf :
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.0.0.255;
option routers 81.27.195.17;
option domain-name-servers 81.27.192.32;
subnet 81.27.195.0 netmask 255.255.255.128 {not authoritative;}
subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.2 10.0.0.5;
}

This is displayed when I start dhcpd daemon :
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 Socket/eth0/81.27.195.0/25
Sending on Socket/eth0/81.27.195.0/25

When I connect my notebook win2000 at home to my switch it
doesn't obtain IP, GW, DNS and SUBNET MASK automaticaly
although my notebook is setup to obtain IP and DNS
automaticaly from dhcp server [at my work it works].
When I wrote ps -aux I see that dhcpd is running.
I think that my notebook should obtain IP in range
10.0.0.2-5, GW 81.27.195.17, MASK 255.255.255.0 and
DNS 81.27.192.32.
Can you help why it doesn't work?

Thank you, Manek.
 
If you want to run your Linux box as a router, you need to use 2 network cards (eth0 and eth1).

<marc> i wonder what will happen if i press this...[pc][ul][li]please give feedback on what works / what doesn't[/li][li]need some help? how to get a better answer: faq581-3339[/li][/ul]
 
Thanks for reply,

but I'm using 1 network card eth0 on my &quot;router&quot; and I works correctly in case of fix IP adresses in my subnet but I would like provide dhcp adresses for computers in my subnet. In case fix adresses it works correctly because masquerading [NAT] is provided on higher layers so you can have connected 2 different IP nets to one switch.

Manek
 
I confess I have never tried running a Linux router with a single NIC using a psudo interface for the second IP so I cant say if it will or wont work.

But You can confirm that the dhcpd server is listening for dhcp broadcasts with the following command:

netstat -an | grep &quot;:67&quot;

You should get something back like:
udp 0 0 0.0.0.0:67 0.0.0.0:*

The fourth colum is the IP address and port seporated by a colon :)) {0.0.0.0 means its listening on ALL interfaces) so if you have two NIC cards, eth0 and eth1 then it will listen on BOTH!

I dont see where you set-up your eth1 interface?

I would have setup eth0:0 as normal (as you have) and eth0:1 as the second &quot;virtual&quot; interface.

How about your firewall rules! Are you SURE you are not blocking udp:67 ?

Last but not least, here is my /etc/dhcpd.conf, I am running a LTS test environment so I use fixed IP/MAC Address to each client but it may help you identify your fault:

more /etc/dhcpd.conf
# Sample configuration file for dhcpd
#
# Make changes to this file and copy it to /etc/dhcpd.conf
#

default-lease-time 21600;
max-lease-time 21600;

option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.254;
option domain-name-servers 192.168.1.254;
option domain-name &quot;mydomain.com&quot;;
option root-path &quot;192.168.1.254:/opt/ltsp/i386&quot;;

shared-network WORKSTATIONS {
subnet 192.168.1.0 netmask 255.255.255.0 {
}
}

group {
use-host-decl-names on;
option log-servers 192.168.1.254;

host ws001 {
hardware ethernet 00:04:56:98:44:ab;
fixed-address 192.168.1.30;
filename &quot;/lts/vmlinuz-2.4.19-ltsp-1&quot;;
## option option-128 e4:45:74:68:00:00; #This is NOT a MAC address
## option option-129 &quot;NIC=ne IO=0x300&quot;;
}
host ws002 {
hardware ethernet 00:D0:06:44:6A:1C;
fixed-address 192.168.1.33;
filename &quot;/lts/vmlinuz-2.4.9-ltsp-6&quot;;
}
}

<END>
NOTE: for this to work reliably you must have the IP's in the /etc/hosts file e.g.

ws001 192.169.1.30
ws002 192.168.1.33

I hope this helps,
Good Luck,
Laurie.
 
You shouldn't have any problems running a router through an Virtual interface and DHCP running through the eth0.


Having recently just setup DHCP here I can show you my dhcpd.conf file that works 100%.

Enjoy

$ more /etc/dhcpd.conf
authorative;
server-identifier server.xxxx.com;
ddns-update-style interim;
subnet 10.44.27.0 netmask 255.255.255.0 {
range 10.44.27.2 10.44.27.6;
default-lease-time 18000; max-lease-time 36000;
one-lease-per-client true;
ddns-updates on;
ddns-domainname &quot;xxx.com&quot;;
ddns-rev-domainname &quot;in-addr.arpa&quot;;
option subnet-mask 255.255.255.0;
option broadcast-address 10.44.27.255;
option routers 10.44.27.254;
option domain-name-servers 10.44.27.1;
option domain-name &quot;xxxx.com&quot;;
}

This is a DDNS setup so yo can either remove the DDNS-* stuff from it or add in


zone &quot;27.44.10.in-addr.arpa&quot; {
type master;
file &quot;db.27.44.10.in-addr.arpa&quot;;
allow-update {10.44.27.1;};

};


to your /etc/named.conf


Cheers



 
Thank you all of you,
the sun is shining again and the days and nights of trouble with configuration dhcp are passed.
The problem was in using two different IP adresses on one interface eth0 so I did as you wrote. IP 81.27.195.17 on eth0 and IP 10.0.0.1 on eth0:1.

Manek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top