Networking Forums

Networking Forums > Computer Networking > Linux Networking > assigning multiple IP address to one interface via dhcpd

Reply
Thread Tools Display Modes

assigning multiple IP address to one interface via dhcpd

 
 
Nejat AYDIN
Guest
Posts: n/a

 
      06-04-2004, 05:22 PM
Hi,

I wonder if it is possible to assign multiple IP addresses to
a dhcp client's interface via dhcpd (based on the interface's MAC).
If so, what would the configuration (dhcpd.conf file) on the
server side look like ?
 
Reply With Quote
 
 
 
 
Ed
Guest
Posts: n/a

 
      06-05-2004, 05:57 PM
On Fri, 04 Jun 2004 20:22:49 +0300, Nejat AYDIN wrote:

> Hi,
>
> I wonder if it is possible to assign multiple IP addresses to
> a dhcp client's interface via dhcpd (based on the interface's MAC).
> If so, what would the configuration (dhcpd.conf file) on the
> server side look like ?


The following is my personal config. It will assign an IP depending on
the MAC. Hope this helps. BTW, all in the man pages...

# dhcpd.conf
#
# Configuration file for ISC dhcpd (see 'man dhcpd.conf')
#

default-lease-time 28800;
max-lease-time 43200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.0.1;
option domain-name-servers 192.168.0.1, 212.10.160.1, 212.10.160.2;
# rem domain-name for nslookup probs
option domain-name "domain.com";
# added as stated in dhcpd.conf man page
ddns-update-style ad-hoc;

subnet 192.168.0.0 netmask 255.255.255.0 {
# range 192.168.0.10 192.168.0.20;
}

host pc-1 {
hardware ethernet 99:99:99:99:99:14;
fixed-address 192.168.0.10;
}

host w2k {
hardware ethernet 99:99:99:99:99:13;
fixed-address 192.168.0.11;
}

host pc-6 {
hardware ethernet 99:99:99:99:99:12;
fixed-address 192.168.0.19;
}

host pc-3 {
hardware ethernet 99:99:99:99:99:11;
fixed-address 192.168.0.20;
}

Hope this helps,
Ed.
 
Reply With Quote
 
Nejat AYDIN
Guest
Posts: n/a

 
      06-06-2004, 12:59 PM
Ed wrote:
>
> On Fri, 04 Jun 2004 20:22:49 +0300, Nejat AYDIN wrote:
>
> > Hi,
> >
> > I wonder if it is possible to assign multiple IP addresses to
> > a dhcp client's interface via dhcpd (based on the interface's MAC).
> > If so, what would the configuration (dhcpd.conf file) on the
> > server side look like ?

>
> The following is my personal config. It will assign an IP depending on
> the MAC. Hope this helps. BTW, all in the man pages...


[...]

Sorry, this is not the answer to my question. What you have done is
to assign one IP address to one interface via dhcp, which is trivial
and I know how to do. But I want to assign *multiple* IP addresses to
one interface (ie, IP aliasing), via dhcp.
 
Reply With Quote
 
Rudolf Potucek
Guest
Posts: n/a

 
      06-06-2004, 06:09 PM
Look on deja ... I have variously been looking for this and have always
discarded it as impractical even thought the solution is described out
there ... apparently there is another dhcp client that will do it but I
never tried.

Rudolf

[Snip]pets of what Nejat AYDIN
<(E-Mail Removed)> wrote: : Ed wrote:
:>
:> On Fri, 04 Jun 2004 20:22:49 +0300, Nejat AYDIN wrote:
:>
:> > Hi,
:> >
:> > I wonder if it is possible to assign multiple IP addresses to
:> > a dhcp client's interface via dhcpd (based on the interface's MAC).
:> > If so, what would the configuration (dhcpd.conf file) on the
:> > server side look like ?
:>
:> The following is my personal config. It will assign an IP depending on
:> the MAC. Hope this helps. BTW, all in the man pages...

: [...]

: Sorry, this is not the answer to my question. What you have done is
: to assign one IP address to one interface via dhcp, which is trivial
: and I know how to do. But I want to assign *multiple* IP addresses to
: one interface (ie, IP aliasing), via dhcp.

--
The biggest spendings on MY credit card are Pizza ...
.... and Patents.
Rudolf, Dec. 15, 2002
 
Reply With Quote
 
Cameron Kerr
Guest
Posts: n/a

 
      06-07-2004, 12:26 AM
Nejat AYDIN <(E-Mail Removed)> wrote:

> I wonder if it is possible to assign multiple IP addresses to
> a dhcp client's interface via dhcpd (based on the interface's MAC).


Certainly, in theory, but you'll need to do a few things.

If you want to assign by MAC address, then every virtual interface must
have a distinct MAC address.

By default, aliased MAC interfaces (eth0:1 for instance) all have the
same MAC address. It appears that I can't change this (using 'ifconfig
eth0:1 hw ether NEWMACADDR'). I get 'Device or resource busy' when I
try.

It would not be a great idea to do it this way anyway, as you would need
to be very cautious as to how you allocate MAC addresses so they don't
clash. (Although changing the first three bytes should be relatively
safe).

I think a better idea may be to allocate using a DHCP name. I've never
done this before, so I can't tell you what's involved. But you would
need to run the client for each interface, so that you can tell the
client to use a different name for each interface. If the machine is
called 'bob', then you would run your dhcp client advertising a name of
'bob-eth0:1' for instance, repeating for each virtual interface.

If you're using Debian, you could put the following in
/etc/network/interfaces. You should use the dhcpcd client. I've tried
this (unsuccessfully) using dhclient, and I doubt pump is flexible
enough to allow you to specify a client-identifier on the command line.

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet dhcp
client_id bob-eth0:0

auto eth0:1
iface eth0:1 inet dhcp
client_id bob-eth0:1



Now, let's see if I can take a crack at setting up dhcpd to use
client_id as a basis for handing out names.

Here is a relevant section (abridged) from dhcpd.conf(5)

Host declarations are matched to actual DHCP or BOOTP clients by
matching the dhcp-client-identifier option specified in the
host declaration to the one supplied by the client, or, if the
host declaration or the client does not provide a
dhcp-client-identifier option, by matching the hardware
parameter in the host declaration to the network hardware address
supplied by the client. [...]

Please be aware that only the dhcp-client-identifier option
and the hardware address can be used to match a host
declaration. [...]

So, given that I'm requesting the MAC-based address for eth0, and
client_id-based addresses for the aliased interfaces, this should
hopefully work.

host bob {
hardware ethernet 00:40:F4:6F:BB:F0;
fixed-address bob.localdomain;
}

host bob-eth0_0 {
option dhcp-client-identifier "bob-eth0:0";
fixed-address 10.18.2.50;
}

host bob-eth0_1 {
option dhcp-client-identifier "bob-eth0:1";
fixed-address 10.18.2.51;
}


Testing this however, is a pain. I've tried with dhclient and dhcpcd.
Neither of which was happy to configure an interface that didn't exist
at the time. Of the two, dhcpcd would probably be preferable, as it
allows for a command-line option to specify the client identifier.

When I 'ifconfig eth0:0 up', it fails (Cannot assign requested address).
Seems as if it must be given an address to be created, it's not enough
to just have it 'UP'. I consider this a bug.

dhcpcd won't even configure the interface if I configure it with a dummy
address of 127.0.0.1 first (it say's the interface has been configured
with it's old address. I wonder if it gets confused because of the
colon?


In conclusion, you probably could do it, but getting your clients to
wrangle the task correctly could take a lot of work.

--
Cameron Kerr
(E-Mail Removed) : http://nzgeeks.org/cameron/
Empowered by Perl!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command for assigning IPv6 address and MAC address on the interface iceman Linux Networking 7 03-03-2008 07:51 PM
Assigning IP to virtual network interface under chroot() jail. latin0511@gmail.com Linux Networking 3 09-04-2006 07:05 PM
Assigning IP Range to Wildcard MAC-Adresses with ISC dhcpd Robert Braeutigam Linux Networking 2 03-11-2005 10:17 AM
DHCP assigning multiple IPs =?Utf-8?B?QW5hdGEgbW8=?= Windows Networking 3 01-16-2004 09:31 PM
dhcpd: Assigning address to dual boot machine Todd Aiken Linux Networking 0 08-10-2003 05:31 AM



1 2 3 4 5 6 7 8 9 10 11