Re: Using different hostnames on different interfaces (with dhclient)



Hi and thanks for the reply.

On Mon, Jan 23, 2012 at 10:48 PM, Dan Williams <dcbw redhat com> wrote:
>> I'm using Ubuntu 11.04 at work and I have 2 NICs, each connected to a
>> separate subnet. Only one of the subnets is accessible when I VPN to
>> work, so I thought it would be cool to be able to use different
>> hostnames for each interface. I tried the following in
>> /etc/dhcp/dhclient.conf:
>>
>> interface "eth4" {
>>    send host-name "host2";
>> }
>>
>> interface "eth5" {
>>    send host-name "host1";
>> }
>
> At the moment NM allows the dhclient hostname to be specified in two
> ways:
>
> 1) via the NM connection configuration
> 2) via an interface-specific dhclient config file
> like /etc/dhcp/dhclient-<iface>.conf
>
> So we could add support for the combined dhclient I suppose, making sure
> to only use stuff for the right interface.  It's just not implemented at
> this time.  If you split the config out into separate per-interface
> config files in the same location, it should work.

I tried the following:
$ cat /etc/dhcp/dhclient-eth4.conf

send host-name "host2";

$ cat /etc/dhcp/dhclient-eth5.conf
send host-name "host1";

However, I still get the IP from eth4 mapped to host1.

In /var/run/nm-dhclient-eth4.conf I see:

send host-name "host1"; # added by NetworkManager

While nm-dhclient-eth5.conf doesn't have any "send host-name" directive.

What would option 1 involve?

The NM version installed is 0.8.4~git.20110319t175609.d14809b-0ubuntu3.

Thanks,
Stefan.

>
> Dan
>


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