Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have recently setup a DHCP-Server on an Ubuntu 10.04 server machine. The machine has two interfaces (eth0, eth1). I have the DHCP server setup correctly because computers connecting to the network get a DHCP IP address but they cannot connect to the outside world.

I believe it has to do with the two interfaces being mapped/bridged together. How do I properly map one interface to the other? Is it bridging or mapping?

I see on this page: https://help.ubuntu.com/community/dhcp3-server they do something like

mapping hotplug
    script grep
    map eth1

What does that exactly do?

In other places I see the following:

iface br0 inet static
bridge_ports eth0 eth1

Which is better or more efficient?

Sorry for all the questions, I'm a noob at setting up a DCHP Server.

Thanks for your help.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

Edit /etc/network/interfaces to have a section like this:

iface br0 inet static
   bridge_ports eth0 eth1
   address 192.168.0.1
   netmask 255.255.255.0

(This is assuming you are using 192.168.0.x addressses for you dhcp server.) Then you just use br0 instead of eth0 or eth1 when you are doing your configuration file. With this method, you don't need anything fancy in the configuration file to try to connect the two interfaces to each other. You just need a section that tells the DHCP server to run on br0, just like it was one ethernet port. You could use a section something like this for the DHCP server:

subnet 192.168.0.0 netmask 255.255.255.0 {

        option routers                  192.168.0.1; #You might have to comment this line out.
        option subnet-mask              255.255.255.0;
        option broadcast-address        192.168.0.255;
        default-lease-time 86400;
        max-lease-time 86400;
}



Hopefully that answers your question as you asked it. However, it sounds like maybe you are trying to share internet among multiple computers. You think you need a DHCP server to do that, and so you are trying to set one up. Am I right so far? If so, there should be a simpler solution:
(this solution assumes you get addresses automatically on eth0. If you have to set them manually, this method would still work, but there would be extra steps)
First, shut down all your eth0 and eth1 interfaces. (sudo ifdown ethX if you're using /etc/network/interfaces to manage them, or disconnect in NetworkManager applet if you are using that.) Then edit /etc/network/interfaces and add a section like this (commenting out eth0 or eth1 sections if needed):

iface br0 inet dhcp
   bridge_ports eth0 eth1

then do sudo ifup br0. This should make your ports eth0 and eth1 act just like a networking switch, except that your Ubuntu computer is also plugged into this networking switch. Assuming that you could automatically get addresses on eth0 before, this will be passed on to eth1 computers also.

Let me know how my answer works.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.