DHCP server with multiple interfaces on ubuntu, destroys default gateway

Posted by Henrik Alstad on Ask Ubuntu See other posts from Ask Ubuntu or by Henrik Alstad
Published on 2012-10-16T14:25:18Z Indexed on 2012/10/16 17:21 UTC
Read the original article Hit count: 446

Filed under:
|
|

I use Ubuntu, and I have many interfaces. eth0, which is my internet connection, and it gets its info from a DHCP-server totally outisde of my control.

I then have eth1,eth2,eth3 and eth4 which I have created a DHCP-server for.(ISC DHCP-Server)

It seems to work, and I even get an IP-address from the foreign DHCP-server on the internet facing interface.

However, for some reason it seems my gateway for eth0 became screwed after I installed my local DHCP-server for eth1-eth4. (I think so because I got an IP for eth0, and I can ping other stuff on the local network, but I cannot get access to the internet).

My eth0-specific info in /etc/network/interfaces: auto lo iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
  address 10.0.1.1
  netmask 255.255.255.0
  network 10.0.1.0
  broadcast 10.0.1.255
  gateway 10.0.1.1
  mtu 8192


auto eth2
iface eth2 inet static
  address 10.0.2.1
  netmask 255.255.255.0
  network 10.0.2.0
  broadcast 10.0.2.255
  gateway 10.0.2.1
  mtu 8192

My /etc/default/isc-dhcp-server:

INTERFACES="eth1 eth2 eth3 eth4"

So why does my local DHCP-server fuck up the gateway for eth0, when I tell it not to listen to eth0? Anyone see the problem or what I can do to fix it?

The problem seems indeed to be the gateways. "netstat -nr" gives:

0.0.0.0 --- 10.X.X.X ---- 0.0.0.0 --- UG 0 0 0 eth3

It should have been

0.0.0.0 129.2XX.X.X 0.0.0.0 UG 0 0 0 eth0

So for some reason, my local DHCP-server overrides the gateway I get from the network DHCP.

Edit: dhcp.conf looks like this(I included info only for eth1 subnet):

ddns-update-style none;

not authoritative;

subnet 10.0.1.0 netmask 255.255.255.0 { interface eth1; 
option domain-name "example.org"; 
option domain-name-servers ns1.example.org, 
ns2.example.org; 
default-lease-time 600; 
max-lease-time 7200;
range 10.0.1.10 10.0.1.100;
host camera1_1 { hardware ethernet 00:30:53:11:24:6E; fixed-address 10.0.1.10; }
host camera2_1 { hardware ethernet 00:30:53:10:16:70; fixed-address 10.0.1.11; } 
}

Also, it seems that the gateway is correctly set if I run "/etc/init.d/networking restart" in a terminal, but that's not helpful for me, I need the correct gateway to be set during startup, and i'd rather find the source of the problem

© Ask Ubuntu or respective owner

DHCP server with multiple interfaces on ubuntu, destroys default gateway

Posted by Henrik Kjus Alstad on Super User See other posts from Super User or by Henrik Kjus Alstad
Published on 2012-10-16T16:10:11Z Indexed on 2012/10/16 17:07 UTC
Read the original article Hit count: 446

Filed under:
|
|

I use Ubuntu, and I have many interfaces. eth0, which is my internet connection, and it gets its info from a DHCP-server totally outisde of my control.

I then have eth1,eth2,eth3 and eth4 which I have created a DHCP-server for.(ISC DHCP-Server)

It seems to work, and I even get an IP-address from the foreign DHCP-server on the internet facing interface.

However, for some reason it seems my gateway for eth0 became screwed after I installed my local DHCP-server for eth1-eth4. (I think so because I got an IP for eth0, and I can ping other stuff on the local network, but I cannot get access to the internet).

My eth0-specific info in /etc/network/interfaces: auto lo iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
  address 10.0.1.1
  netmask 255.255.255.0
  network 10.0.1.0
  broadcast 10.0.1.255
  gateway 10.0.1.1
  mtu 8192


auto eth2
iface eth2 inet static
  address 10.0.2.1
  netmask 255.255.255.0
  network 10.0.2.0
  broadcast 10.0.2.255
  gateway 10.0.2.1
  mtu 8192

My /etc/default/isc-dhcp-server:

INTERFACES="eth1 eth2 eth3 eth4"

So why does my local DHCP-server fuck up the gateway for eth0, when I tell it not to listen to eth0? Anyone see the problem or what I can do to fix it?

The problem seems indeed to be the gateways. "netstat -nr" gives:

0.0.0.0 --- 10.X.X.X ---- 0.0.0.0 --- UG 0 0 0 eth3

It should have been

0.0.0.0 129.2XX.X.X 0.0.0.0 UG 0 0 0 eth0

So for some reason, my local DHCP-server overrides the gateway I get from the network DHCP.

Edit: dhcp.conf looks like this(I included info only for eth1 subnet):

ddns-update-style none;

not authoritative;

subnet 10.0.1.0 netmask 255.255.255.0 { interface eth1; 
option domain-name "example.org"; 
option domain-name-servers ns1.example.org, 
ns2.example.org; 
default-lease-time 600; 
max-lease-time 7200;
range 10.0.1.10 10.0.1.100;
host camera1_1 { hardware ethernet 00:30:53:11:24:6E; fixed-address 10.0.1.10; }
host camera2_1 { hardware ethernet 00:30:53:10:16:70; fixed-address 10.0.1.11; } 
}

Also, it seems that the gateway is correctly set if I run "/etc/init.d/networking restart" in a terminal, but that's not helpful for me, I need the correct gateway to be set during startup, and i'd rather find the source of the problem

© Super User or respective owner

Related posts about server

Related posts about dhcpd