Debian – Create virtual network adapter with own MAC and IP

bridgedebiannetworking

I have a server with 4 different IPs over one real NIC. Now i try to setup different virtual network adapter in debian with this IPs. The Problem is, that each IP needs also a specific MAC. Otherwise the connection over the IP will not working.

So first a created a new virtual NIC with a specific MAC:

ip link add link eth0 mac1 address 00:11:22:33:44:55 type macvlan mode bridge

This works very well. After this I set the IP and and the netmask with.

ifconfig mac1 192.168.34.23 netmask 255.255.255.255 broadcast 192.168.34.23

Then I turned the new virtual NIC on with:

ifconfig mac1 up.

Now I can see the virtual NIC over ifconfig with my set settings.

But if I try now to ping a website over this interface with:

ping -I mac1 google.de

I get no response.

I don't know why.

What is my mistake or is there a different way to create a virtual NIC with own MAC and IP ?

Best Answer

You used a netmask of 255.255.255.255 (also known as /32), which may mean that this address isn't part of a local network with your default gateway. Try using a netmask that extends to more addresses in order to include the gateway address in the local network.

Related Question