Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to setup a Slackware 10.2 DHCP server to replace my Win2k box, I would like to leave Eth0 on DHCP so that it will grab an IP address from my cable modem.
I would then like Eth1 to run as the DHCP server and hand out IP addresses to the PCs on the network. I have tried a couple of different configs that I found online but so far nothing has worked.
first thing to do would be to get your LAN card properly IP-configured, then make sure you can ping to and from clients on the LAN... is that the step you are currently on?? once that's done, you'd just need to start configuring your DHCP daemon... slackware comes with dhcpd and dnsmasq - which one are you using??
RC.DHCPD when I run it says that it starts, but then when I do IP ADDR the ETH1 NIC is never assigned an IP address. On my Win2k box the 1st NIC gets its IP address from the cable modem, then through connection sharing the 2nd NIC ends up with 192.168.0.1 and then hands out .2, .3, .etc.
Is Eth1 supposed to get some kind of x.x.x.1 address or will it just show up in IP ADDR with no address at all but still function as a DHCP server, I guess I'm confused about this point, I know how it works in Windows just not in Linux, I'm assuming that they should work the same.
When I run DNSMASQ I get error: "Failed to bind listening socket for 192.168.0.58: address already in use.", if I move the network cable from Eth0 to Eth1 and run it again I still get the same error.
From what I have heard I would prefer to run DNSMASQ since it comes built into Linux instead of having to manually configure the files needed to make DHCPD work.
RC.DHCPD when I run it says that it starts, but then when I do IP ADDR the ETH1 NIC is never assigned an IP address. On my Win2k box the 1st NIC gets its IP address from the cable modem, then through connection sharing the 2nd NIC ends up with 192.168.0.1 and then hands out .2, .3, .etc.
Is Eth1 supposed to get some kind of x.x.x.1 address or will it just show up in IP ADDR with no address at all but still function as a DHCP server, I guess I'm confused about this point, I know how it works in Windows just not in Linux, I'm assuming that they should work the same.
your LAN interface will need to be statically configured by you - it's a separate issue... just give it a proper IP/netmask and you're set... look in the /etc/rc.d/rc.inet1.conf file...
Quote:
When I run DNSMASQ I get error: "Failed to bind listening socket for 192.168.0.58: address already in use.", if I move the network cable from Eth0 to Eth1 and run it again I still get the same error.
please post the output of:
Code:
ifconfig
Code:
route -n
Quote:
From what I have heard I would prefer to run DNSMASQ since it comes built into Linux instead of having to manually configure the files needed to make DHCPD work.
not sure what you mean... dnsmasq is not built into linux in any way...
BTW to make dhcpd work you basically just need to edit the /etc/dhcpd.conf file (if it doesn't exist just create it)... here's an *example* of what one might look like, assuming the LAN interface has the IP of 192.168.1.1/24 and will function as the gateway for the LAN (it's pretty straight-forward):
I ran a cross over cable to one of my PCs and plugged it into Eth1, that PC is getting its IP address from the Linux box now 192.168.1.x instead of 192.168.0.x from the Windows server. /release /renew also worked, I can also ping the DNS name I gave the Linux box from the Win2k pc that is not the Windows server.
Only thing that doesn't work is that PC no longer has an Internet connection (surfing and IM's don't work), assuming that I need to set up some kind of routing table or I am missing something in the DHCPD.CONF file.
Config I am using is:
# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#
ddns-update-style none;
Only thing that doesn't work is that PC no longer has an Internet connection (surfing and IM's don't work), assuming that I need to set up some kind of routing table or I am missing something in the DHCPD.CONF file.
have you enabled IP forwarding?? check with:
Code:
cat /proc/sys/net/ipv4/ip_forward
if ip_forward is set to 0 then it's disabled... enable it with a:
Code:
echo 1 > /proc/sys/net/ipv4/ip_forward
have you enabled masquerading?? check with:
Code:
iptables -L
Code:
iptables -t nat -L
if you don't have masquerading setup, this example /etc/rc.d/rc.firewall script should do it:
Code:
#!/bin/sh
IPT="/usr/sbin/iptables"
LAN_IFACE="eth1"
WAN_IFACE="eth0"
$IPT -P FORWARD DROP
$IPT -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPT -A FORWARD -i $LAN_IFACE -o $WAN_IFACE \
-m state --state NEW -j ACCEPT
$IPT -t nat -A POSTROUTING -o $WAN_IFACE -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
I created /etc/rc.d/rc.firewall using your config file, after starting rc.dhcpd and rc.firewall DHCP and surfing both work fine now on the PC that I have plugged into Eth1,
Will probably take the Windows server down tonight and put this Linux box in its place, have to back up all the data files first though.
Where can I stick rc.dhcpd and rc.firewall so that they will both auto-start when the system boots up?
for the record, i would like to mention that it's strange you had to edit rc.local for this... in fact, having your firewall script start so late in the startup process could be considered a secuirty issue...
On this LAN I am not worried about it being a security issue (I'm the only Geek in the house (everyone else would be considered a "User")), but if there is a better way to do it how would I go about doing it?
On this LAN I am not worried about it being a security issue (I'm the only Geek in the house (everyone else would be considered a "User")), but if there is a better way to do it how would I go about doing it?
on slackware, making your /etc/rc.d/rc.firewall be executable is enough... slackware's network startup scripts are set to look for that file and execute it if present and executable...
BTW, here's a more complete version of the rc.firewall i posted:
i highly recommend this one instead of the example i previously posted...
as for dhcpd, a line like this in your rc.local is what you'd want:
Code:
/usr/sbin/dhcpd eth1
notice how the interface you want the daemon to listen on is specified... also notice how no rc.dhcpd is used, as slackware 10.2 doesn't come with one...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.