LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   dhcpd.conf configuration and internet access (https://www.linuxquestions.org/questions/linux-networking-3/dhcpd-conf-configuration-and-internet-access-746768/)

andrews-mark 08-11-2009 11:06 AM

dhcpd.conf configuration and internet access
 
Hello,
I have a ubuntu machine with two NICs. This has internet access through one NIC. The other is connected to a switch to which other machines connect. I have set up this machine to be a dhcp server and serve out local IPs to the connecting clients. I have successfully done this so that any machine connecting up to the switch gets an IP address (e.g. 192.168.0.2). This allows the client to connect to the host. However, these clients can not get on to the internet. In other words, they are limited to communication with the machines on a LAN. I presume that I have not the written the dhcpd.conf properly.

Here is my dhcpd.conf on the host
Code:

ddns-update-style none;

default-lease-time 259200;
max-lease-time 5184000;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
option routers 192.168.0.1;

subnet 192.168.0.0 netmask 255.255.255.0 {
  group {
  host amfortas{
        hardware ethernet 00:1d:60:e2:61:1a;
        fixed-address 192.168.0.2;
  }
  host lohengrin{
        hardware ethernet 00:1F:D0:21:3C:66;
        fixed-address 192.168.0.3;
  }
  }
}

and here is /etc/network/interfaces on lohengrin (a client)
Code:

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

As I said, lohengrin can get an IP and can then ssh to and from the host. However, if I try to do something like "ssh 82.71.38.83" from lohengrin it does nothing (no errors messages, just hangs there until I control+c it), while I can successfully ssh into 82.71.38.83 from the host machine.

I presume there is something small that I am stupidly missing. Can anyone see what I have done wrong and how I could fix it?

-mark

markush 08-11-2009 11:28 AM

We can get more information if you post the output of ifconfig of one of the dhcp-clients.

Markus

andrews-mark 08-11-2009 05:43 PM

Dear Markus,

Thanks for your offer of help. I don't have any command called "ifconf":

Code:

andrews@ssh.lohengrin ~> ifconf
-bash: ifconf: command not found
andrews@ssh.lohengrin ~> sudo ifconf
sudo: ifconf: command not found

but I have "ifconfig" and here is the output from "lohengrin"

Code:

andrews@ssh.lohengrin ~> ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1f:d0:21:3c:66 
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::21f:d0ff:fe21:3c66/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:421774 errors:0 dropped:25396230342 overruns:0 frame:0
          TX packets:334552 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:156199763 (148.9 MB)  TX bytes:62962480 (60.0 MB)
          Interrupt:249 Base address:0x4000

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:11700 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11700 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:807420 (788.4 KB)  TX bytes:807420 (788.4 KB)

For comparison, here is "ifconfig" on wotan (the dhcp server and host):
Code:

andrews@ssh.wotan ~> ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:e6:dd:ae:0c 
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::216:e6ff:fedd:ae0c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:336452 errors:0 dropped:0 overruns:0 frame:0
          TX packets:259489 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:22030669 (21.0 MB)  TX bytes:922941417 (880.1 MB)
          Interrupt:16

eth1      Link encap:Ethernet  HWaddr 00:18:4d:ea:77:52 
          inet addr:128.40.26.160  Bcast:128.40.26.255  Mask:255.255.255.0
          inet6 addr: fe80::218:4dff:feea:7752/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:20344104 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12455605 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:3975717650 (3.7 GB)  TX bytes:15290659227 (14.2 GB)
          Interrupt:19 Base address:0x4000

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:6369 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6369 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:504066 (492.2 KB)  TX bytes:504066 (492.2 KB)


markush 08-12-2009 03:00 AM

Sorry, I meant ifconfig (as you stated).

I did still not understand how exactly your connection to the internet should work. If It is a ppp-connection there would b a 32bit mask (255.255.255.255) for eth1 on wotan. but I don't know.

Since the connection between the computers on your local lan works there dhcp should be properly.

What about the routes (between the two nics), what I mean is that this machine with the two nics should function as a router.

Markus

andrews-mark 08-12-2009 03:45 AM

Markus,
Thanks for the reply again.
From what you said, it may be that the dhcp server config is not the issue, but rather I do not have the host set up properly to route between the two NICs. That makes sense, and I will look into it.
-m


All times are GMT -5. The time now is 02:08 PM.