PDA

View Full Version : iptables advice


chrno
15th September 2008, 17:50
My setup:

Vmware Host (eth0) --- iptables (NAT) --- Vmware GuestOS (vmnet1 :: 192.168.101.0/24)


My iptables config:


# Masquerade all traffic (allow NAT traffic through VM Guest)
# vmnet1 host-only network 192.168.101.0/255.255.255.0

iptables --table nat -A POSTROUTING --out-interface eth0 -j MASQUERADE
iptables -A FORWARD --in-interface vmnet1 -j ACCEPT
iptables -A INPUT -i vmnet1 -s 192.168.101.0/24 -d $SERVER_IP -j ACCEPT



I would like to access SAMBA (this sits on the Vmware Host) from within Vmware GuestOS.
e.g. \\192.168.101.1\SAMBA


I'm at a lost at how to configure the iptables to grant this access from the Vmware GuestOS.

Any help or recommendations will be kindly appreciated.



chrno

falko
16th September 2008, 19:19
You must open the ports 137 - 139.

chrno
17th September 2008, 18:24
Awesome! All sorted ... :D

chrno



iptables -A INPUT -p udp -s 192.168.101.0/24 -d 192.168.101.1 --dport 137 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p udp -s 192.168.101.1 --sport 137 -d 192.168.101.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p udp -s 192.168.101.0/24 -d 192.168.101.1 --dport 138 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p udp -s 192.168.101.1 --sport 138 -d 192.168.101.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp -s 192.168.101.0/24 -d 192.168.101.1 --dport 139 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.101.1 --sport 139 -d 192.168.101.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT

iptables -A INPUT -p tcp -s 192.168.101.0/24 -d 192.168.101.1 --dport 445 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -p tcp -s 192.168.101.1 --sport 445 -d 192.168.101.0/24 -m state --state ESTABLISHED,RELATED -j ACCEPT