LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Gateway / DHCP Server problem on Slackware (https://www.linuxquestions.org/questions/linux-networking-3/gateway-dhcp-server-problem-on-slackware-189883/)

captain_bogus 06-04-2004 11:41 PM

Gateway / DHCP Server problem on Slackware
 
Hi,

I know many people have asked similar questions but I have not been able to find an answer for this. I'm trying to set up my slackware box as a router. I don't want to get a router specific distro, and I don't want to buy a router.

I have 2 nics in my Slackware box. eth0 lined up to my Roadruner cable modem (Toshiba). eth1 lined up to my XP box. The Slackware box can see the internet just fine, but the XP box tells me that my network cable is unplugged.

When I line up the XP box to the cable modem directly it works just fine.

I dled, compiled and installed dhcpd from isc.org. I used their example for my dhcpd.conf:

# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
# Sample /etc/dhcpd.conf
# (add your comments here)
ddns-update-style ad-hoc;
default-lease-time 600;
max-lease-time 7200;
#
subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.200 192.168.100.240;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.100.255;
option routers 192.168.100.3;
option domain-name-servers 192.168.100.3;
option domain-name "mydomain.cxm";
option ip-forwarding on;
option netbios-node-type 8;
}

But what I think is my problem is my eth1...When I type ifconfig -a I get:

eth0 Link encap:Ethernet HWaddr 00:50:BA:D9:C3:89
inet addr:24.27.71.172 Bcast:255.255.255.255 Mask:255.255.240.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:52665 errors:0 dropped:0 overruns:0 frame:0
TX packets:1128 errors:0 dropped:0 overruns:0 carrier:0
collisions:82 txqueuelen:100
RX bytes:3987914 (3.8 Mb) TX bytes:194357 (189.8 Kb)
Interrupt:5 Base address:0xf000

eth1 Link encap:Ethernet HWaddr 00:60:08:27:82:3F
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:10 Base address:0x1040

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:86 errors:0 dropped:0 overruns:0 frame:0
TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4684 (4.5 Kb) TX bytes:4684 (4.5 Kb)

Finally, when I type dhcpd eth1 -d -f I get "Not listening for connection on any interface."

Any ideas? I'm stumped.

Thanks,
captain_bogus

larry 06-05-2004 12:33 AM

k looks like multiple issues:

1: eth1 does not have a network address. try this:
Code:

ifconfig eth1 192.168.1.1 broadcast 192.168.1.255 netmask 255.255.255.0
this will setup eth1 to communicate with your local network

2. that dhcpd.conf is not for you. try using this:

Code:

default-lease-time 3600;        # 24h
max-lease-time 86400;          # 24h
 
subnet 192.168.1.0 netmask 255.255.25.0 {
 
        range 192.168.1.10 192.168.1.150;    #obviously the range of ips to use
 
        option subnet-mask 255.255.255.0;    #subnet mask to give to dhcp client
        option broadcast-address 192.168.1.255;    #broadcast address to give client
 
        option routers 192.168.1.1;        #this is your router (eth1 if you configure it like above)
        #option domain-name-servers 206.141.239.142;    #uncomment this and add your isp's dns server
        #option domain-name-servers 192.168.1.1;      #unless your like me and have your own or have a second one
        option domain-name "domain.com";        #this is the domainname that will be given out
}

3.
Quote:

eth1 lined up to my XP box
d00d i hope you dont mean you connected one end to the slackbox and the other end to the xp box. i am going to pretend you didnt and are using a hub or switch.

the only thing left is to make sure the xp box nick is set to full dhcp. you should not have to assign anything to it. it should obtain everything from your dhcp server.

of course there is an easier way by not using dhcp but hey if this doesnt work let me know.

hell let me know anyway

--larry

thats what i get for not previewing! :D

larry 06-05-2004 01:24 AM

yah i just thought of something else.

you are going to have to set up ip forwarding/masquerading on the router as well. this can be a detailed subject but you might be able to get by on doing this:

Code:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward

otherwise read up on this here

--larry

captain_bogus 06-05-2004 05:01 PM

ok, I did all that. I WAS lining up my XP box directly to my Slackware box, lol. Since nothing I had read said how to line things up I assumed that you could hook up two nics and they could talk to one another. I inserted a hub/switch. To be clear I lined up the Slackware box to the uplink in the hub and put the XP box on "X1". Now my XP box does not say the ethernet cable is unplugged.

Here is my ifconfig -a:

eth0 Link encap:Ethernet HWaddr 00:50:BA:D9:C3:89
inet addr:24.27.71.172 Bcast:255.255.255.255 Mask:255.255.240.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:44437 errors:0 dropped:0 overruns:0 frame:0
TX packets:1031 errors:0 dropped:0 overruns:0 carrier:0
collisions:54 txqueuelen:100
RX bytes:3107099 (2.9 Mb) TX bytes:156717 (153.0 Kb)
Interrupt:5 Base address:0xf000

eth1 Link encap:Ethernet HWaddr 00:60:08:27:82:3F
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:10 Base address:0x1040

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:96 errors:0 dropped:0 overruns:0 frame:0
TX packets:96 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5184 (5.0 Kb) TX bytes:5184 (5.0 Kb)

And my route:
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
255.255.255.255 * 255.255.255.255 UH 0 0 0 eth1
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
24.27.64.0 * 255.255.240.0 U 0 0 0 eth0
loopback * 255.0.0.0 U 0 0 0 lo
default 24.27.64.1 0.0.0.0 UG 0 0 0 eth0

I typed in "route add -host 255.255.255 dev eth1" because the guide on isc.org said all Windows clients need it. The XP box didn't work with or without it.

I wasn't sure what to put in for my "option.domain.server"...here is the contents of my resolv.conf:

nameserver 24.28.99.63
nameserver 24.28.99.64
nameserver 24.93.40.77
search houston.rr.com

I just used the first one. Here is my current dhcpd.conf:

#/etc/dhcpd.conf from larry@linuxquestions.org 6/5/2004
default-lease-time 3600; # 24h
max-lease-time 86400; # 24h
ddns-update-style ad-hoc;
subnet 192.168.1.0 netmask 255.255.255.0 {

range 192.168.1.10 192.168.1.150; #obviously the range of ips to use

option subnet-mask 255.255.255.0; #subnet mask to give to dhcp client
option broadcast-address 192.168.1.255; #broadcast address to give client

option routers 192.168.1.1; #this is your router (eth1 if you configure it like above)
option domain-name-servers 24.28.99.63; #uncomment this and add your isp's dns server
#option domain-name-servers 192.168.1.1; #unless your like me and have your own or have a second one
option domain-name "mydomain.com"; #this is the domainname that will be given out
}


Larry, you said there is an easier way than using DHCP, what do you mean? I'm game for easier. I just want to be able to see the internet on both my machines without buying a router.

I appreciate your help.

Thanks,
captain_bogus

larry 06-05-2004 05:36 PM

ok your almost there.

take the slack box out of the uplink spot and just put it in normal slot (X2 ?). This should allow your xp box to obtain a ip from your slackbox. from there we can see if there are any other issues (ie. masquerading).

the easier way (also after you move the cable of the slack box):

setup your xp box like this:

ip: 192.168.1.2
mask: 255.255.255.0
broadcast address: 192.168.1.255
default gateway: 192.168.1.1
DNS : 24.28.99.63

that is it. then you need to setup masqerading. try the example from above first and let me know.

--larry

ps
Quote:

I typed in "route add -host 255.255.255 dev eth1" because the guide on isc.org said all Windows clients need it.
there is no reason for this.

captain_bogus 06-05-2004 06:20 PM

EXCELLENT!!! As soon as I took the line out of the uplink and put it in a regular spot, my XP firewall detected an "intrusion attempt" from my slackbox, lol! I double clicked IE and it worked. Thank you so much.

A related question. The commands:

ifconfig eth1 192.168.1.1 broadcast 192.168.1.255 netmask 255.255.255.0
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
dhcpd eth1

Where could I put those so that they exeute on start up and does it matter in which order they execute?

Thanks,
captain_bogus

larry 06-05-2004 06:50 PM

best way thing to do is throught them into a file. Maybe create a file /etc/rc.d/rc.netshare (or sumthin) and put all that into it. do
Code:

chmod 755 /etc/rc.d/rc.netshare
(to make it executable) .then at the end of /etc/rc.d/rc.local put /etc/rc.d/rc.netshare. This way everytime the computer is restarted it will be executed.

As far as order goes, just make sure to do the ifconfig first. Otherwise you will have nothing to reference the other commands to.

Hey im glad it worked. Now go and spread the wealth!!

--larry

captain_bogus 06-07-2004 10:07 AM

The solution works perfectly. Thank you for all your help!

I have a new (seemingly unrelated?) problem that has resulted since implementing the solutions above. In X I can hit alt-F1 to AltF6 to get a command line terminal, right? Well for some reason F2 through F5 are locked up. There is a blinking cursor at the top of the screen but typing doesn't do anything. there is no text on the screen asking forr a log-on. Luckily F6 still works. I can log-on as normal. Any idea what this is?

Thanks,
captain_bogus

kennedy01 06-10-2004 09:45 AM

Resolution, did dhcpd ever work?
 
Curious if you ever got dhcpd running so that the XP box was set to dynamically get an IP?

captain_bogus 06-15-2004 09:43 AM

kennedy01,

Yes, I never had to change settings on the XP box. Once I lined up the hub correctly it started right up.

captain_bogus

Diademed 10-06-2004 10:17 PM

This thread got me working too!!!! w00t!!!! heh, sorry, it's a spur of the moment, bliss bump!

NightSky 11-25-2008 01:28 PM

Good DHCP Server Thread
 
Thanks for the xmas gift:) 2 Quick ques. can I use 2Wiregateway with this setup? Will this give me a usable website address with my dynamic is add?
Thanks much, I learn with these types of threads!


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