I would like to create several aliases to eth0, but have the addresses assigned by DHCP instead of being set to static IP's. Is this even possible?
All the examples I've seen assign a static IP using the command:
ifconfig eth0:0 192.168.1.11 up
This is only possible if the two DHCP clients use different MAC addresses. Which means they cannot run both on the same physical network interface, which has a single MAC address.
The solution is Linux's virtual MAC-VLAN network interfaces. MAC-VLAN interfaces are virtual network interfaces backed by a physical interface, but using with a different MAC address, which is randomly generated when you create a MAC-VLAN device.
Once you create a MAC-VLAN interface using a physical interface, you use it the same way like you would the physical one. In your particular case, you can run one DHCP client on the physical interface, and another on the MAC-VLAN device. Each device (physical and MAC-VLAN) can then have its own IP address.
A new MAC-VLAN device
It can be deleted by running
Using NCD, my network configuration software ( http://code.google.com/p/badvpn/wiki/NCD ), the following NCD program will create two MAC-VLAN devices from
You'll end up with
Using static or DHCP assigned IP addresses is a choice you make for your computer.
There is a good tutorial here.
It contains plenty of detail, and helps you avoid problems that you can have if you use static instead of DHCP assigned address, e.g. how to connect to DNS servers and gateways.
I dont know for sure But i believe unless you have a open source router then you will have to use static IP to do what you want. IMO unless you have a REALLY good reason for why you want to do what you want I would just stick witrh DHCP. from your question i see thats what you want so unless someone knows how to do it I would wait and stay with DHCP until someone gives a better answer. Although if you dont have more than 1-2 pcs and nothing else on the network (printers media extenders etc) then I would not use Static IPs as IDK how or if it is possible to set these items with a static IP. Maybe you can do what you want if you get an Open source Router and you may be able to make it do what you want like just use a static IP for your machine using the mac address as a way to identify it and set its IP and the rest of the network could bne DHCP. IDK as i have never done thins i am just throwing out ideas so Sorry for not having an answer for you. Although the link posed by Bryan looks like a nice resource on DHCP ans Static IP issues. Also For the Open Source router I believe Netgear and D-Link make them I am sure more but IMO these two brands are the ones I would choose. I personally dont like Linksys since they were bought by novel (you would think they would be better but NOT IMO. Personally I prefer D-link as they are the most customizeable routers i have found.)
Also check out this link and you may be able to do more with your router if it is supported
I have never seen a DHCP configuration which would allow the DHCP server to send multiple addresses to an interface. I don't believe the protocol supports it. Once you get into multiple IP addresses on an interface, you really should configure them as static addresses.
Some DHCP clients allow static address to be assigned when an address is supplied. I don't believe Windows will allow you to add more than one.
Make sure all your static addresses are outside the DCHP address range.
No, you can't do that. DHCP assigns an IP based on your hardware address. Each physical interface only have one of those, thus DHCP will only assign one IP to a physical interface.
I would advise you to just set the interface IPs statically.