dhcp is used even if the NIC is set to static ip address in /etc/network/interfaces

Asked by xmaximex on 2009-11-15

I have a linux gateway running Ubuntu 9.10. There's 2 NIC. The WAN interface, eth0, is configured using DHCP (cable modem). The LAN interface, eth1, is configured with a static IP address:

# Interface WAN
auto eth0
iface eth0 inet dhcp

# Interface LAN
auto eth1
iface eth1 inet static
address 10.0.0.1
netmask 255.255.255.0

The server is running a DHCP server for the LAN but dhclient always try to configure eth1 with the DHCP server that is running on the server:

Nov 15 11:55:32 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:55:49 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:56:08 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:56:19 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:56:31 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:56:40 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67
Nov 15 11:56:48 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 10.0.0.1 port 67

This problem appeared after I installed karmic. It was running jaunty but I had to reinstall it.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
2009-11-16
Last reply:
2009-11-16
Cristi Nistor (cristi-nistor) said : #1

What are the setting for Network Manager? And what is the output of ifconfig command?

xmaximex (xmaximex) said : #2

It's ubuntu server so I don't use Network Manager

Here's some info:

root@yoda:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0d:60:c2:70:6b
          inet addr:X.X.X.X Bcast:255.255.255.255 Mask:255.255.255.0
          inet6 addr: XXXX::XXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:10966 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4295 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2354429 (2.3 MB) TX bytes:1551822 (1.5 MB)

eth1 Link encap:Ethernet HWaddr 00:90:27:2d:5c:3b
          inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0
          inet6 addr: fe80::290:27ff:fe2d:5c3b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
          RX packets:3263 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3065 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:488281 (488.2 KB) TX bytes:1787931 (1.7 MB)

/etc/dhcp3/dhclient.conf:
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

send host-name "<hostname>";
prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
 domain-name, domain-name-servers, domain-search, host-name,
 netbios-name-servers, netbios-scope, interface-mtu,
 rfc3442-classless-static-routes, ntp-servers;

lease {
 interface "eth0";
}

/etc/dhcp3/dhcpd.conf:
default-lease-time 86400;
max-lease-time 604800;

authoritative;
subnet 10.0.0.0 netmask 255.255.255.0 {
 range 10.0.0.20 10.0.0.100;
 option routers 10.0.0.1;
 option domain-name-servers 10.0.0.1;
 option domain-name "network.local";
}

/var/log/syslog:
Nov 16 11:00:43 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:00:59 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 255.255.255.255 port 67
Nov 16 11:00:59 yoda dhcpd: DHCPREQUEST for 10.0.0.21 from 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:00:59 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:20 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 255.255.255.255 port 67
Nov 16 11:01:20 yoda dhcpd: DHCPREQUEST for 10.0.0.21 from 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:20 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:35 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 255.255.255.255 port 67
Nov 16 11:01:35 yoda dhcpd: DHCPREQUEST for 10.0.0.21 from 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:35 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:52 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 255.255.255.255 port 67
Nov 16 11:01:52 yoda dhcpd: DHCPREQUEST for 10.0.0.21 from 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:01:52 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:02:02 yoda dhcpd: DHCPOFFER on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:02:02 yoda dhclient: DHCPOFFER of 10.0.0.21 from 10.0.0.1
Nov 16 11:02:02 yoda dhclient: DHCPREQUEST of 10.0.0.21 on eth1 to 255.255.255.255 port 67
Nov 16 11:02:02 yoda dhcpd: DHCPREQUEST for 10.0.0.21 (10.0.0.1) from 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:02:02 yoda dhcpd: DHCPACK on 10.0.0.21 to 00:90:27:2d:5c:3b (yoda) via eth1
Nov 16 11:02:02 yoda dhclient: DHCPACK of 10.0.0.21 from 10.0.0.1
Nov 16 11:02:02 yoda dhclient: bound to 10.0.0.21 -- renewal in 43129 seconds.

I temporarily fixed the problem by adding a reservation in dhcpd.conf

Cristi Nistor (cristi-nistor) said : #3

It should be 2 different networks (or even 2 different IP classes) for the 2 NICs. You have the DHCP lease range for eth0 between10.0.0.20 and 10.0.0.100, and the static IP for the second NIC (eth1) in the same IP network, 10.0.0.1, which is also set as router (gateway) for eth0. Try changing the IP network for eth1 (10.0.1.1 or something similar, but different from 10.0.0.1).

Here is a good reference for seting a network using 2 NICs:

http://aboutdebian.com/network.htm

Good luck.

xmaximex (xmaximex) said : #4

The 2 NICs are not on the same ip network.

eth0 is my cable modem with public ip. The gateway for this NIC is not 10.0.0.1.. it's the gateway from my ISP
eth1 is the LAN with private ip (10.0.0.1/24)

Can you help with this problem?

Provide an answer of your own, or ask xmaximex for more information if necessary.

To post a message you must log in.