Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a machine running Ubuntu 12.04 Server with two interfaces connected (eth0, eth1) to the network. Our network is set up so that a FreeBSD based DHCP server hands out leases and registers the client supplied host names with a DNS server on the same network.

The two interfaces need to have different host names to register both on DNS. In /etc/network/interfaces I have added the hostname for eth1:

# The primary network interface (hostname: host0)
auto eth0
iface eth0 inet dhcp

# Secondary interface 
auto eth1
iface eth1 inet dhcp
  hostname host1

The dhcp client config looks something like this:

    option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

    send host-name "<hostname>";
    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,
            dhcp6.domain-search, dhcp6.fqdn,
            dhcp6.name-servers, dhcp6.sntp-servers;

The leases obtained look like this:


# /var/run/resolvconf/interface/eth0.dhclient
lease {
  interface "eth0";
  fixed-address 192.168.28.249;
  option subnet-mask 255.255.255.0;
  option routers 192.168.28.30;
  option dhcp-lease-time 129600;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.28.1,192.168.24.58;
  option dhcp-server-identifier 192.168.28.1;
  option ntp-servers 192.168.28.1,192.168.58.43,192.168.24.58;
  option broadcast-address 192.168.28.255;
  option domain-name "some.org";
  renew 4 2014/02/20 01:00:39;
  rebind 4 2014/02/20 15:31:19;
  expire 4 2014/02/20 20:01:19;
}

# /var/run/resolvconf/interface/eth1.dhclient
lease {
  interface "eth1";
  fixed-address 192.168.19.69;
  option subnet-mask 255.255.255.0;
  option routers 192.168.19.30;
  option dhcp-lease-time 129600;
  option dhcp-message-type 5;
  option domain-name-servers 192.168.28.1,192.168.24.58;
  option dhcp-server-identifier 192.168.28.1;
  option ntp-servers 192.168.28.1,192.168.58.43,192.168.24.58;
  option broadcast-address 192.168.19.255;
  option domain-name "some.org";
  renew 3 2014/02/19 21:56:46;
  rebind 4 2014/02/20 15:30:42;
  expire 4 2014/02/20 20:00:42;
}

I do not have control over the FreeBSD DHCP server, but have been told the leases were recorded as:


#####################
lease 192.168.28.249 {
starts 5 2014/02/14 03:24:14;
ends 6 2014/02/15 15:24:14;
cltt 5 2014/02/14 03:24:14;
binding state active;
next binding state free;
hardware ethernet 00:01:02:03:04:12;
set ddns-rev-name = "249.28.168.192.in-addr.arpa.";
set ddns-fwd-name = "host0.dhcp.some.org";
client-hostname "host0";
on expiry or release {
switch (ns-update (delete (1, 12, ddns-rev-name, null))) {
case 0:
unset ddns-rev-name ;
break;
}
switch (ns-update (delete (1, 1, ddns-fwd-name, leased-address))) {
case 0:
unset ddns-fwd-name ;
break;
}
on expiry or release;
}
}
lease 192.168.19.69 {
starts 4 2014/02/13 14:40:47;
ends 6 2014/02/15 02:40:47;
cltt 4 2014/02/13 14:40:47;
binding state active;
next binding state free;
hardware ethernet 00:01:02:03:04:14;
client-hostname "host0";
}

#####################

In both leases on the server side the client-hostname has the value "host0". Note that the leases were handed out on two different subnets: 192.168.28.0 and 192.168.19.0.

Is my /etc/network/interfaces configuration all that is needed for sending the secondary interface's hostname to the DHCP server? If so, what else should I check on the client side to debug?

(IP addresses and MAC addresses were modified to hide real values)

share|improve this question
    
have you disable the network-manager ? becasue if you run ubuntu with this configuration and the network manager it will never work. –  Kiwy Feb 19 at 11:06
    
Sorry, I should have specified this is a server, I don't think Ubuntu Server includes the NetworkManager? (Question updated) –  Ries Feb 19 at 11:17
    
well if you do not install gnome nor unity no network-manager is not installed. –  Kiwy Feb 19 at 11:39
    
Confirmed. Ubuntu Server 12.04 with no desktop manager. –  Ries Feb 19 at 12:01
1  
You can add virtual network interfaces to a physical interface, there is no need for two separate network cards. They will only interfere with each other. –  vonbrand Feb 20 at 1:05
show 4 more comments

1 Answer

In Linux you can add virtual interfaces to physical ones, and configure and manage them separately (for some long forgotten twisted reason we had our workstations living in two different IP networks running on the same cable for a while). So you really don't need two Ethernet cards, they will probably only interfere with each other.

I don't know if DHCP is up to configuring virtual interfaces. I'd guess not, it's mission is to assign network parameters, and probably covers only the common cases.

share|improve this answer
    
But if I set up the virtual interfaces manually they should be able to each get their own IP addresses hopefully while informing the DHCP server of their unique hostnames? I am not sure how this is different from having two physical interfaces. Its a rack mount server that comes with 2 ethernet ports by default. –  Ries Feb 20 at 19:06
1  
If two physical network cards are "interfering" with each other, something is severely broken on that system. –  Jenny D Apr 15 at 6:32
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.