Help setting up DHCP
Results 1 to 8 of 8

Thread: Help setting up DHCP

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Posts
    229

    Help setting up DHCP

    Ok, I'm gonna try and explain this the best I can cause my set-up is a little harry. Don't ask we why I'm doing this, I'm just trying to learn!

    Here's my setup... The DHCP server is the '***'


    Internet
    |
    |
    |
    D-Link Rounter (192.168.0.1) ------ Downstairs XP Box (192.168.0.100)
    |
    |
    Switch ------- Upstairs XP Box (192.168.0.101)
    |
    |
    ***Upstairs Ubuntu Linux Box (192.168.0.102) 3 NICS
    |
    L eth2 (connected to switch)
    |
    L eth1 (does nothing so far)
    |
    L eth0 ------ Windows XP Laptop


    In this figure, I want to get the Windows Laptop to resolve an address from the DHCP Ubuntu Server. What I have done is installed dhcp3 (apt-get install dhcp3...) and then tried to do things the way they did on http://ubuntuguide.org/#installdhcpserver
    , I used eth0 for the interface that will serve requests like they did, when it came to the second part of the dhcp.conf I commented everything like they did. However, on the second part I changed things to fit my situation, so it looks like this...


    Code:
    # A slightly different configuration for an internal subnet.
    subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.10 10.0.0.100;
    option subnet-mask 255.255.255.0;
    option routers 10.0.0.1;
    #........
    #........
    then, I finally type 'sudo /etc/init.d/dhcp3-server restart' and get this...

    Code:
    Stopping DHCP Server: dhcpd3.
    Starting DHCP Server: dhcpd3 failed to start - check syslog for diagnostics.
    I have both eth0 and eth2 active on my Network Settings and am able to connect to the internet from the Linux Box, however (needless to say) my Windows XP Laptop behind my DHCP Server can't get an IP address

    I appreciate any help greatly, I hope to get this running so I can get to the next phase of my little project!
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Posts
    229

    update

    Update:

    woot I got the dhcp server to come live, I simply added this to the file /etc/network/interfaces...

    Code:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    
    auto eth0
    iface eth0 inet static
    name Local Ethernet LAN card
    address 10.0.0.1
    netmask 255.255.255.0
    broadcast 10.0.0.255
    network 10.0.0.0
    gateway 10.0.0.1
     
    iface eth1 inet dhcp
    name Ethernet LAN card (WAN)
    
    auto eth1
    and then re-typed 'sudo /etc/init.d/dhcp3-server restart' and got...

    Code:
    Stopping DHCP Server: dhcpd3.
    Starting DHCP Server: dhcpd3.
    So I was like, nice... and then turned on my Windows Laptop to see if it gets an IP and it does, it comes up with 10.0.0.99 with the default gateway as 10.0.0.1.

    Unfortunately, even though it grabs an IP it still cannot get to the internet, I can't even ping 10.0.0.1 (100% packet loss) niether can the server get to the internet. It keeps wanting to use the eth0 interface as the default gateway and not eth2?

    Any advice? Thanks a bunch!
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

  3. #3
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi

    I use the following notation:
    A = Upstairs Ubuntu Linux Box
    ( A.eth2 = 192.168.0.102
    A.eth0 = 100.0.0.1 (DHCP bound here) )
    B = Windows XP Laptop

    0. in your /etc/network/interfaces, are you sure about "gateway 10.0.0.1"?
    I would leave this "default gateway" blank and add the routings by hand
    with "route", see below.

    1. B gets the IP 10.0.0.99, MASK 255.255.255.0 and Gateway 10.0.0.1.
    It can "ping 127.0.0.1", "ping 10.0.0.99" but not "ping 10.0.0.1"?
    Any Firewalls? Packet loss? Maybe A.eth0 does handle these request
    incorrectly, ie wrong routing (see below) ... ? Check with a sniffer,
    whether the ping actually is sent from B?

    2. What tells you "ifconfig" on A? "netstat -i"?

    3. Routing. Check with "route" the routing table for the various interfaces.
    Eth0 and Eth2 should know what to do with 10.0.0.*, 192.168.0.*
    (and 0.0.0.0, default). Check [1-3] for further information.


    Cheers




    [1] http://www.aboutdebian.com/network.htm
    [2] http://www.debian.org/doc/manuals/ne.../ch-tcpip.html
    [3] http://www.antionline.com/showthread...ighlight=route
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  4. #4
    Senior Member
    Join Date
    Jul 2002
    Posts
    229
    Hello Sec, thanks for taking the time to help me out.

    Your notion is correct, that is exactly what I want to do with one minor correction, A.eth0=10.0.0.1 (DHCP bound) not 100.0.0.1 (but I'll assume that was a simple mis-type).

    In my network interfaces I commented the bottom part with the gateway and that seemed to be able to get the DHCP server to now connect to the internet again. The conputer now sees eth2 as the default gateway, which is good because eth2 is outgoing to the internet.

    Now as for pinging, I can ping 192.168.0.1, 10.0.0.99, www.google.com, 10.0.0.1, and 127.0.0.1. One weird thing though is that after about 10 minuites of reloading the network I will not be able to ping either of those addresses (with the exception of 127.0.0.1), however, if I reload the network interfaces 'sudo /etc/init.d/networking restart', it will work again. (Just thought that was weird).

    On the 10.0.0.99 Laptop I can ping 10.0.0.1, 10.0.0.99, and 192.168.0.102 but nothing outside that such as 192.168.0.1.

    Here is what ifconfig -a tells me,

    Code:
    root@ubuntu:/etc/network # ifconfig -a
    eth0      Link encap:Ethernet  HWaddr 00:50:BA:54:02:E8
              inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
              inet6 addr: fe80::250:baff:fe54:2e8/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:322 errors:0 dropped:0 overruns:0 frame:0
              TX packets:2993 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:44418 (43.3 KiB)  TX bytes:318528 (311.0 KiB)
              Interrupt:11 Base address:0xa000 
    
    eth1      Link encap:Ethernet  HWaddr 00:50:BA:B9:7E:05
              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:1000
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
              Interrupt:10 Base address:0x9800
    
    eth2      Link encap:Ethernet  HWaddr 00:04:76:21:3D:37
              inet addr:192.168.0.102  Bcast:192.168.0.255  Mask:255.255.255.0
              inet6 addr: fe80::204:76ff:fe21:3d37/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:26101 errors:0 dropped:0 overruns:1 frame:0
              TX packets:3216 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:8434577 (8.0 MiB)  TX bytes:370424 (361.7 KiB)
              Interrupt:5 Base address:0x9400 
    
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING  MTU:16436  Metric:1
              RX packets:199453 errors:0 dropped:0 overruns:0 frame:0
              TX packets:199453 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:18434130 (17.5 MiB)  TX bytes:18434130 (17.5 MiB)
    
    sit0      Link encap:IPv6-in-IPv4
              NOARP  MTU:1480  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:0
              RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
    this is what I get with netstat -i...

    Code:
    root@ubuntu:/etc/network # netstat -i
    Kernel Interface table
    Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR   TX-OK TX-ERR TX-DRP TX-OVR Flg
    eth0   1500 0       338      0      0      0    3048      0      0      0 BMRU
    eth2   1500 0     26613      0      0      1    3354      0      0      0 BMRU
    lo    16436 0    202890      0      0      0  202890      0      0      0 LRU
    this is what i get with route...

    Code:
    root@ubuntu:/etc/network # route
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    10.0.0.0        *               255.255.255.0   U     0      0        0 eth0
    192.168.0.0     *               255.255.255.0   U     0      0        0 eth2
    default         192.168.0.1     0.0.0.0         UG    0      0        0 eth2
    That seems, to be ok, but then again I'm new at this. I'm thinking that the problem must be that 192.168.0.102 (eth2) is not properly routing the packets to 192.168.0.1 (the router) Thanks for your insight.
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

  5. #5
    Super Moderator
    Know-it-All Master Beaver

    Join Date
    Jan 2003
    Posts
    3,914
    Hey Hey,

    A Linux router is fairly easy to setup but there's one key command that you have to remember to run

    Code:
    echo 1 > /proc/sys/net/ipv4/ip_forward
    That is what's required to get forwarding (routing) to occur... Did you run that command?

    You can verify by doing cat /proc/sys/net/ipv4/ip_forward and seeing if the result is a 0 or a 1... If the result is a 0 that's why it's not working.

    Peace
    HT
    IT Blog: .:Computer Defense:.
    PnCHd (Pronounced Pinched): Acronym - Point 'n Click Hacked. As in: "That website was pinched" or "The skiddie pinched my computer because I forgot to patch".

  6. #6
    Senior Member
    Join Date
    Jul 2002
    Posts
    229
    Hey HTRegz,

    I ran that command but still no dice

    I'm really thinking it has something to do with eth2 not forwarding the requests to the real router (192.168.0.1). Mainly, because my Laptop can ping everything under the sun except anything outside eth2 (192.168.0.102).

    Anyone have a clue how to fix this? Thanks I appreciate all the excellent help!
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

  7. #7
    Senior Member
    Join Date
    Mar 2004
    Posts
    557
    Hi Radical

    Thanks for the pinging information. Based on this, I strongly suspect
    you have forgotten to add routing information to your D-Link Router
    (192.168.0.1).

    Add routing information for the network 10.0.0.0/24 to your D-Link
    Router and your problem will be solved (99% sure ). The D-Link
    Router should sent packets for 10.0.0.0/24 to 192.168.0.102.

    Reason: You can reach A.eth2 from B. If you want to ping any other
    host in 192.168.0.0/24 except 192.168.0.102, on that particular
    host, routing information are not available, therefore sent to the standard
    gateway 192.168.0.1, which also does not know what to do.

    Cheers
    If the only tool you have is a hammer, you tend to see every problem as a nail.
    (Abraham Maslow, Psychologist, 1908-70)

  8. #8
    Senior Member
    Join Date
    Jul 2002
    Posts
    229
    Allllllright chums,

    I am updateing this thread in case any one ever has the same difficulties that I had. However, I would first like to humbly thanks sec_ware, for whom without I would be totally lost on this.

    Sec_ware's last post about the router being the issue would have been correct, however the router I was using (the D-Link) did not support static routes (a quick call to technical support confirmed this). Afterwards, sec_ware and I exchanged a total of 13 PMs trying to get this to work! And eventually we got it working just great!

    Here's the short version of how we got this to work (without all the technical hurdles),

    We needed a way for the D-Link router to think that the data from 10.0.0.99 was coming from 192.168.0.102 so it wouldn't get confused with the packet IP. Then we needed a way for 192.168.0.102 to be able to figure out how to forward the packets on to thier original sender on the alternate LAN. Setting up a proxy server did the trick just perfectly...

    Read allllll about it! http://www.aboutdebian.com/proxy.htm

    After this was done, I was finally able to access the internet via 10.0.0.99 by sucessfully doing a tracert to 194.109.137.218 (www.aboutdebian.com) however, when I tried doing a tracert to www.aboutdebian.com using it's domain name, no dice. This was obviously because something was wrong with the 10.0.0.99's DNS settings.

    The solution to this in my case was to build a basic LAN, DNS server on 192.168.0.102. Which may sound difficult, but was probly one of the most easiest things I have ever done reguarding this project.

    Read about how to do that here... http://www.aboutdebian.com/dns.htm

    After that, 10.0.0.99 had full internet functionality!

    And that ladies and gents is how you setup a DHCP/Proxy/DNS server . Once again just want to thank sec_ware for taking the time out of his schedule to help me out doing this. Sec, you da techie !
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides