You are not logged in.

#1 2020-12-31 20:14:21

rep_movsd
Member
Registered: 2013-08-24
Posts: 80

iptables rules to allow KVM Windows guest to mount NFS share on host?

I am using a Windows 7 VM on KVM with virt-manager
I was never able to get any kind of file sharing to work with Samba, so I decided to use NFS instead.

I setup my NFS server etc - but the guest cannot mount the shared drive unless the firewall is disabled
I have the following rules in iptables.rules

*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [89:4852]
:TCP - [0:0]
:UDP - [0:0]
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m conntrack --ctstate INVALID -j DROP
-A INPUT -p icmp -m icmp --icmp-type 8 -m conntrack --ctstate NEW -j ACCEPT
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
-A INPUT -p udp -m conntrack --ctstate NEW -j UDP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m conntrack --ctstate NEW -j TCP
-A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 3000 -j ACCEPT
-A INPUT -s 127.0.0.0/8 -p tcp -m tcp --dport 3000 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 3000 -j DROP
-A TCP -p tcp -m tcp --dport 3000 -j ACCEPT

# NFS rules
-A INPUT -s 192.168.122.0/24  -d 192.168.122.0/24  -p udp -m multiport --dports 10053,111,2049,32769,875,892 -m state --state NEW,ESTABLISHED -j ACCEPT 
-A INPUT -s 192.168.122.0/24  -d 192.168.122.0/24  -p tcp -m multiport --dports 10053,111,2049,32803,875,892 -m state --state NEW,ESTABLISHED -j ACCEPT 
-A OUTPUT -s 192.168.122.0/24  -d 192.168.122.0/24  -p udp -m multiport --sports 10053,111,2049,32769,875,892 -m state --state ESTABLISHED -j ACCEPT 
-A OUTPUT -s 192.168.122.0/24  -d 192.168.122.0/24  -p tcp -m multiport --sports 10053,111,2049,32803,875,892 -m state --state ESTABLISHED -j ACCEPT 
-I INPUT  -i lo -d 127.0.0.1 -j ACCEPT
-I OUTPUT  -o lo -s 127.0.0.1 -j ACCEPT

My virbr0 interface is on 192.168.122.1/24
From the VM the host is 192.168.122.1

What should I change in the above rules to get it to work?

Thanks in Advance

Offline

Board footer

Powered by FluxBB