Networking Forums

Networking Forums > Computer Networking > Linux Networking > Possible to run dhcp on interface aliases?

Reply
Thread Tools Display Modes

Possible to run dhcp on interface aliases?

 
 
David Brower
Guest
Posts: n/a

 
      02-24-2005, 02:16 PM
Does anyone know how to run dhcp on an interface
alias on Linux? That is, I want to have more
than one address for a machine with one interface,
but I don't much care what the address is.

It is easy to configure an alias to a fixed address,
but if I attempt to run a dhcpcd against the same
interface to acquire an address, I see:

dad# dhcpcd -t 30 -K -R -Y -N -h dad-vip-vip1 -c
/usr/local/bin/vip-dhcpcd-hook interface eth0:1

Feb 23 21:33:31 dad dhcpcd[19548]: dhcpStart: ioctl SIOCGIFHWADDR: No
such device

If I instantiate a device with no address first, eg:

dad# ifconfig eth0:1 up
dad# ifconfig eth0:1
eth0:1 Link encap:Ethernet HWaddr 00:40:F4:96:FF:EC
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1

there is no difference.

I see that 'ip link show' behaves similarly to dhcpcd:

dbrower@dad:~/src> ip link show eth0
5: eth0: <BROADCAST,MULTICAST,NOTRAILERS,UP> mtu 1500 qdisc noqueue
link/ether 00:40:f4:96:ff:ec brd ff:ff:ff:ff:ff:ff
dbrower@dad:~/src> ip link show eth0:1
Device "eth0:1" does not exist.

This is running on Suse 9.x, if it matters.

Any help appreciated.

thanks,

-dB




 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      02-24-2005, 02:31 PM
On 2005-02-24, David Brower <(E-Mail Removed)> wrote:
> Does anyone know how to run dhcp on an interface
> alias on Linux?


No. The 'interface' doesn't exist if you don't give him an address, so
it can't acquire an IP from a dhcp server.

Davide
--
The best Windows accelerator is that which works at 9.81 m/s2
-- From a Slashdot.org post
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      02-24-2005, 06:11 PM
On Thu, 24 Feb 2005, David Brower <(E-Mail Removed)> wrote:
> Does anyone know how to run dhcp on an interface
> alias on Linux? That is, I want to have more
> than one address for a machine with one interface,
> but I don't much care what the address is.


I believe DHCP typically only gives out 1 IP per MAC address. But you
could set eth0 be dhcp assigned and assign static IP(s) to eth0:0, etc.
However, if multiple IPs on an interface are same IP range and netmask,
that may result in other problems.
 
Reply With Quote
 
David Brower
Guest
Posts: n/a

 
      02-24-2005, 09:12 PM
Davide Bianchi wrote:
> On 2005-02-24, David Brower <(E-Mail Removed)> wrote:
>>Does anyone know how to run dhcp on an interface
>>alias on Linux?

>
> No. The 'interface' doesn't exist if you don't give him an address, so
> it can't acquire an IP from a dhcp server.
>


That's an authoritative sounding answer, and I'm not
questioning the veracity of the statement. I am
wondering if this is a "feature" or an artifact of
implementation in some place. I may be very willing
to make changes to whereever necessary to pull this
off, so I want to understand the implications of going
down that road.

And David Efflandt wrote:

>
> I believe DHCP typically only gives out 1 IP per MAC address.


I believe it is possible to send different UIDs, from which
the dhcp server can send back different addresses. This is
how one forces getting a different address for the same
machine booted from Windows and linux -- they can send the same
MAC, but different UIDs and get different addresses. This
may also be alterable via the vendorClassID and the ClientID
(The -i and -I flags to dhcpcd).

> But you could set eth0 be dhcp assigned and assign static IP(s) to

eth0:0, etc.

I don't want static addresses on anything, period.

> However, if multiple IPs on an interface are same IP
> range and netmask, that may result in other problems.


I do not believe that is an issue, because you can easily
set multiple addresses on the same subnet and interface
if you use static addresses.

thanks,
-dB









 
Reply With Quote
 
David Brower
Guest
Posts: n/a

 
      02-24-2005, 10:04 PM
Turns out to be as easy as you'd like, if you use the
correct syntax to the dhcpcd invocation. The original
attempt is wrong, thinking 'interface' was a keyword, doh:

> dad# dhcpcd -t 30 -K -R -Y -N -h dad-vip-vip1 -c
> /usr/local/bin/vip-dhcpcd-hook interface eth0:1


The following works as you'd expect:

dhcpcd -t 30 -K -R -Y -N -h dad-vip-vip1 -c \
/usr/local/bin/vip-dhcpcd-hook eth0:1

This does not seem to care if eth0:1 exists
before it is called. If it was up with some
other address, the dhcpcd will cheerfully change
it to the negotiated value, and call the hook
program.

So, my problem was my own fault. How did I find it?
By compiling the dhcpcd and seeing what it choked on.
It was having a problem opening the interface named
"interface".

thanks!

-dB
 
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
IP aliases on a DHCP'ed interface Vide Windows Networking 23 04-28-2009 09:28 PM
ISC DHCP - Two subnets on one physical interface. Dan Linux Networking 2 07-31-2007 06:48 PM
DHCP IP lease renewal ok, but a new PC can not obtain an IP ("An error occurred while renewing interface Local Area Connection : unable to cotact your DHCP server. Request has timed out.") Soren Mikkelsen Windows Networking 2 06-02-2005 04:43 PM
Assign DHCP scope per interface Manuel Alves Windows Networking 4 02-15-2005 03:20 PM
Configuring another interface via DHCP Ed Swierk Linux Networking 0 10-31-2003 05:16 PM



1 2 3 4 5 6 7 8 9 10 11