LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-14-2013, 11:21 AM   #1
zininav
LQ Newbie
 
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
samba, iptables windows names resolving not working unless open all incoming udp


This is my iptables script:

#!/bin/sh

/sbin/modprobe ip_conntrack_ftp

/sbin/iptables -F
/sbin/iptables -F -t nat
/sbin/iptables -F -t mangle

/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate INVALID -j DROP
/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate ESTABLISHED -j ACCEPT
/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate RELATED -j ACCEPT

/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -p tcp --dport 22 -j ACCEPT

/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -p tcp --dport 139 -j ACCEPT
/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -p tcp --dport 445 -j ACCEPT

/sbin/iptables -t filter -A INPUT -m udp -p udp --dport 137 -j ACCEPT
/sbin/iptables -t filter -A INPUT -m udp -p udp --dport 138 -j ACCEPT

/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -p icmp -j ACCEPT


# --------> Without this line samba not resolving windows names: -------<<<<<<<
/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -p udp -j ACCEPT


/sbin/iptables -t filter -A INPUT --in-interface eth0 -m conntrack --ctstate NEW -j DROP

/bin/echo 1 >/proc/sys/net/ipv4/ip_forward

/sbin/iptables -t nat -A POSTROUTING -s 10.73.148.2 -o eth0 -j MASQUERADE

So I forced to open all incoming udp packets, otherwise netbios names resolving not working.
 
Old 02-15-2013, 03:54 AM   #2
r0b0
Member
 
Registered: Aug 2004
Location: Europe
Posts: 608

Rep: Reputation: 50
I don't know much about netbios name resolution but I see at least 2 ways you could tacke this:

1. Is eth0 your public (e.g. internet) device? If it is, then why are you even using netbios over internet? If it is a private network, you could as well enable UDP on it.

2. You can track your packets using tcpdump, try to have a look at what ports/protocols are necessary and make specific rules allowing just the necessary ports. I don't believe it would be all random ports.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTABLES dynamically open udp ports on router's firewall for voip goctala Linux - Networking 1 11-29-2011 06:38 AM
how to test iptables which reject all incoming UDP? pqzha1 Linux - Networking 5 05-12-2008 02:26 AM
Iptables wide open, but no UDP packets allowed (all ports closed) please help mfeoli Linux - Networking 1 01-06-2006 09:52 AM
ping not resolving names - iptables PlatinumRik Linux - Security 2 07-28-2004 11:32 PM
Samba resolving names for Windows? plisken Linux - Networking 1 05-10-2002 02:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration