setting up virtual box to SNAT/DNAT

Dave Cramer davec-zxk95TxsVYDyHADnj0MGvQC/G2K4zDHf at public.gmane.org
Wed Jan 13 16:13:19 UTC 2010


I'm trying to setup asterisk inside a virtual box vm on a host with
only one interface. The host is running ubuntu 6.06, and virtualbox
2.2

I can get the host to talk out, but I can't DNAT ports

I've setup a bridge device

# VirtualBox NAT bridge
auto vnet0
iface vnet0 inet static
        address 172.16.0.1
        netmask 255.255.255.0
        bridge_ports none
        bridge_maxwait 0
        bridge_fd 1


Here are the iptables rules

 iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 10022 -j
DNAT --to-destination 172.16.0.113:22
 iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
 iptables -A FORWARD -i eth0 -o vnet0 -m state --state NEW -j ACCEPT
 iptables -A FORWARD -o eth0 -i vnet0 -m state --state NEW -j ACCEPT
 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


if I telnet into port 10022 the guest sees the incoming packet on port
22, but it doesn't go back properly.

Any help would be greatly appreciated.

Dave
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list