[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Setting up dhcp-server on my desktop machine



Csanyi Pal wrote:
> I must recover my server system through ssh connection so so I must to
> setup dhcp-server on my desktop system first so it can provide for the
> server an IP address.

Your server is configured to use dhcp to acquire a network address?

> On my desktop system there I have already installed the network-manager
> package and now I have installed the isc-dhcp-server package too on this
> system. 
> 
> I don't know how to setup my interfaces so I achieve my goal.

Setting up a dhcp server is completely independent of setting up the
/etc/network/interfaces file.  First you should set up your networking
without doing anything about the dhcp server.  Then after networking
is set up as you like it then set up the dhcp server to use the now
existing networking.

> I have sofar following setup on my desktop system:
> 
>  * /etc/network/interfaces
> 
> auto lo
> iface lo inet loopback
> 
> allow-hotplug eth1 # to my ISP

Normally you would not mention eth1 at all if you want network-manager
to manage it.

> allow-hotplug eth0 # LAN to my server
> iface eth0 inet static
>     address 192.168.1.1
>     netmask 255.255.255.0
>     network 192.168.1.0
>     broadcast 192.168.1.255
>     gateway 192.168.1.1

For your own sanity you probably want to add 'auto eth0' in addition
to the 'allow-hotplug eth0' line.

For eth0 you have netmask set which is good.  But you also have
network and broadcast set and those are not necessary to set
explicitly since setting netmask is sufficient.  Having all three
appear in one of the examples as an example of something you could
change if needed but it wasn't expected for them to always be set.

But in error you have set a second gateway on your secondary interface
and are gatewaying back to yourself.  You will get the default gateway
from your ISP on eth1 when network-manager dhcp's an address and
gateway.  That is the one you want.  Remove this second gateway
statement from eth0.  That isn't what you want there.  That by itself
might be the cause of whatever problems you experienced.

Stop there for a moment and test the network and don't proceed to the
dhcp server step until you think the networking is configured
correctly.

>  * /etc/dhcp/dhcpd.conf
> 
> subnet 192.168.1.0 netmask 255.255.255.0 {
>     interface eth0;
>     range 192.168.1.99 192.168.1.99;
>     option routers 192.168.1.1;
>     option subnet-mask 255.255.255.0;
> }

You are missing some of the standard configurations.  Some of this
might not be needed but it is part of the standard template and what I
have in my files.

# The ddns-updates-style parameter controls whether or not the server
# will
# attempt to do a DNS update when a lease is confirmed. We default to
# the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# option definitions common to all supported networks...
option domain-name "example.com";
option domain-name-servers 192.168.1.1, 192.0.43.10;

default-lease-time 600;
max-lease-time 7200;

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

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
    interface eth0;
    range 192.168.1.99 192.168.1.99;
    default-lease-time 86400;
    max-lease-time 86400;
    option routers 192.168.1.1;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.1.255;
}

>  * /etc/default/isc-dhcp-server
> 
> INTERFACES="eth0"

Okay.

> So when I try to start dhcp-server I get an error message:
> sudo /etc/init.d/isc-dhcp-server start
> Starting ISC DHCP server: dhcpdcheck syslog for diagnostics. ... failed!
> failed!

What did /var/log/syslog say?

  # grep dhcpd /var/log/syslog

> sudo ifconfig shows only eth1 but not the eth0:

Because eth0 isn't up.

> I restarted networking but still get not eth0 up:
> sudo /etc/init.d/networking restart

That will only restart interfaces specified with 'auto' and you don't
have auto in any of your interfaces.

To bring up an interface manually you need to use ifup.

  # ifup eth0

> Running /etc/init.d/networking restart is deprecated because it may not
> enable again some interfaces ... (warning). 

Deprecated because things have moved to an event driven hotplug system
instead.  But both can co-exist for a while longer if you add the auto
line.  But in the future get used to interfaces being completely
dynamic.  This topic gets discussion here in the mailing list
regularly.

> I restarted networking with network-manager too but still get not eth0
> up: 
> 
> sudo /etc/init.d/network-manager restart

If your desktop is always online then you might consider avoiding
network-manager.  It is useful on a mobile device that needs to be
selecting different networks at different times.  But wicd does the
job better.  Adn you don't need it on an always on desktop or server
and n-m has so many bad problems that it is best to avoid it when
possible.  Stop network-manager and add this to your interfaces file.

auto eth1
allow-hotplug eth1 # to my ISP
	iface eth1 inet dhcp

Then bring the interface up with ifup.

  # ifup eth1

> What am I missing here?

Hopefully the above will get you going.  Please let us know how it
goes one way or the other.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: