How to pass host interface directly to a VM (using macvtap or ipvtap)?

aleixsr

New Member
Aug 6, 2024
3
0
1
Hello,
I'm deploying Proxmox VE in Azure VMs under Debian 12. It works fine after facing several issues but finally it worked fine.
Right now I want to have one of IP address that I've connected to the host directcly to a VM.

I read a lot and I've seen it is possible using macvtap or ipvtap:
https://developers.redhat.com/blog/...on-to-linux-interfaces-for-virtual-networking
https://virt.kernelnewbies.org/MacVTap
https://gist.github.com/gdamjan/ed095763b8c322ee5bed17e11bbaed6d#file-readme-md
https://gist.github.com/gdamjan/ed095763b8c322ee5bed17e11bbaed6d

The problem I have is that I do not see a way to setup nic settings under proxmox while all documentation I found uses libvirt and you shloud modify VM XML file like this:
XML:
<interface type='direct' trustGuestRxFilters='yes'>
  <source dev='eth0' mode='bridge'/>
  <target dev='macvtap0'/>
  <model type='virtio'/>
  <alias name='net0'/>
  <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</interface>

I know Proxmox VE doesn't use XML files so, how it can be done?

Thank you very much for your help.
 
MACVTAP is currently not directly supported for bridges / VM network interfaces. You should be able to do either 1:1 NAT or configure the IP within the VM itself.
 
MACVTAP is currently not directly supported for bridges / VM network interfaces. You should be able to do either 1:1 NAT or configure the IP within the VM itself.
Thanks for your reply, let me explain more a little bit:
- Azure gives you a public IP address (e.g.: 20.23.159.252) that cannot be set on Azure VM itself, so, they give you a private IP (e.g.: 192.168.101.10) an they set a 1:1 NAT.
- This private IP is set on vmbr0 bridge under Proxmox VE host.
- Of course I can then apply a 2nd NAT from 192.168.101.10 to another private IP set un VM (e.g.: 10.1.254.2)
- For outgoing traffic from 10.1.254.2 to Internet sNAT works fine (I used VNETs under SDN)
- For incoming traffic from 20.23.159.252 --> 192.168.101.10 --> 10.1.254.2 I've read it is possible but not using Proxmox GUI.
- If I'm able to do that I'll have two NATs and also settings not GUI visible.

On the other hand I also tried to use bridge and set same MAC address un vmbr0 and on VM itself but traffic doesn't work from VM to Proxmox VE host nor another device neither another VM. It is because I was trying to use MACVTAP or IPVTAP.

I would like a way to have it to avoid this hassle, can you please help?
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!