Iptables with host-only networking

Discussions related to using VirtualBox on Linux hosts.
Post Reply
ceving
Posts: 5
Joined: 24. Dec 2007, 10:22

Iptables with host-only networking

Post by ceving »

I would like to configure some iptables rules as soon as any vboxnet interface comes up. But the interfaces are not controlled by /etc/network/interfaces like all other interfaces on my Debian host. Is there any other kind of hook which can be used to run some iptables commands after an VirtualBox interface became available?
sej7278
Volunteer
Posts: 1003
Joined: 5. Sep 2008, 14:40
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Solaris, Linux, Windows, OS/2, MacOSX, FreeBSD
Contact:

Re: Iptables with host-only networking

Post by sej7278 »

why don't you use bridged networking, then it more like a real network interface.

i don't see the point of firewalling an interface that can only connect to the host, you might as well not bother with networking at all!
ceving
Posts: 5
Joined: 24. Dec 2007, 10:22

Re: Iptables with host-only networking

Post by ceving »

sej7278 wrote:why don't you use bridged networking, then it more like a real network interface.
Host only interfaces are unreal interfaces?
sej7278
Volunteer
Posts: 1003
Joined: 5. Sep 2008, 14:40
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Solaris, Linux, Windows, OS/2, MacOSX, FreeBSD
Contact:

Re: Iptables with host-only networking

Post by sej7278 »

ceving wrote:
sej7278 wrote:why don't you use bridged networking, then it more like a real network interface.
Host only interfaces are unreal interfaces?
well it only sends traffic between the host and guest (not lan or internet) so a little pointless yes!
blinky
Posts: 6
Joined: 17. Aug 2009, 17:52
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP,Linux,Solaris
Location: UK
Contact:

Re: Iptables with host-only networking

Post by blinky »

sej7278 wrote:
ceving wrote:
sej7278 wrote:why don't you use bridged networking, then it more like a real network interface.
Host only interfaces are unreal interfaces?
well it only sends traffic between the host and guest (not lan or internet) so a little pointless yes!
Not quite true. If your real interface is eth0, then if you enabling forwarding in (/etc/sysctl.conf) and set a rule to NAT all traffic out of eth0 you end up wih a private virtual network (with multiple VM's if you require) that can talk to the everything outside of eth0 (lan/internet).

Add in port forwarding rules to to the host and the VM's can provide services to things on the other side of eth0

I use it for testing out idea's, works well.
ceving
Posts: 5
Joined: 24. Dec 2007, 10:22

Re: Iptables with host-only networking

Post by ceving »

blinky wrote:Add in port forwarding rules to to the host and the VM's can provide services to things on the other side of eth0
Thanks for explaining this. But how about my original question?
Post Reply