2

Brief:

Is there an accepted way to request two IP addresses and reserve them for use by one machine?

I don't believe that I am allowed to get two IPs from a DHCP server with one interface and one MAC address (correct me if I am wrong).

If I choose a static IP, I can't stop the IP being allocated to someone else (correct me if I am wrong).

Details:

I would like multiple IP addresses. Is there some polite way I can request them without risking their being allocated to other people? I could forge a DHCP DORA handshake, but that doesn't seem like the right thing to do. Aside from the issue generating a MAC address, it doesn't seem like there should be a need to provide a MAC address; I only need the DHCP sever to NOT lease out an IP, it doesn't need to manage the IP and manage any associated MAC addresses. I'm happy to manage renewals, NACK and any other nuances.

I could randomly pick static IPs and potentially interfere with some other network user. Static virtual interfaces like this or this or this will work for the purposes of attaining multiple IPs, but DHCP won't be in control of issuing them. I cannot guarantee that they will be free.

I don't believe that virtual DHCP interfaces will work, as DHCP allocations require unique MAC addresses.

You may assume that I am on a work network. I am allowed to connect an arbitrary number of different devices to the network (and hence get any number of IPs allocated with the full consent of the company). However, I only require two, but I only have one network interface (a Raspberry Pi). I understand that I have phrased this as a general networking problem; I only seek to find a solution relevant to the latest Rasberry Pi build (buster).

3

create a file in /etc/network/interfaces.d - lets call it eth0 - doesn't matter what the name is.

In this file add the following

auto eth0
iface eth0 inet manual
  up ip link add link eth0 name eth01 address 02:00:00:00:00:01 type macvlan
  up ip link add link eth0 name eth02 address 02:00:00:00:00:02 type macvlan

Now restart networking

sudo systemctl restart networking

or just reboot

et voila

The value of the mac addresses can be virtually anything, as long as the first 'digit' is either a 2, 6, A or E.

You can name the interfaces anything you like too.

18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.