Distinguish traffic from NAT interface.

Discussions related to using VirtualBox on Linux hosts.
Post Reply
fromer
Posts: 2
Joined: 29. Jun 2015, 21:01

Distinguish traffic from NAT interface.

Post by fromer »

Is it possible to distinguish traffic from guest box with NAT interface (exact setting "Attached to: NAT")?

I need to apply iptables rules on the traffic from virtualbox guest, so netfilter's mark would be great if it's possible to set.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Distinguish traffic from NAT interface.

Post by noteirak »

AFAIK that's not possible. iptables doesn't have a good mechanism to distinguish an application other than the PID or the user/group owner (regardless of application).

My advise would be to use Host-Only with NATing in the host and filter on that.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
fromer
Posts: 2
Joined: 29. Jun 2015, 21:01

Re: Distinguish traffic from NAT interface.

Post by fromer »

noteirak wrote: My advise would be to use Host-Only with NATing in the host and filter on that.
Can't do that unfortunately. Which of the virtualbox processes initiate the traffic? Maybe force it to run under different GID?
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Distinguish traffic from NAT interface.

Post by noteirak »

If you run the VM with the GUI, it will be the VirtualBox process.
If you run without the GUI (in the background), it will be the VBoxHeadless process.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply