Re: IPTables to restrict an IP address to certain ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 18 Mar 2005 09:00:39 -0600, Doug Coats <dcoats@xxxxxxxxxxxxxxxx> wrote:
> Hello all,
> 
> I need to restrict a computer hooked up to my network so that it can only
> access net-bios ports (137-139 I believe).  I idea is to let them transfer
> files and use network printers but nothing else.  The computer will have a
> set IP address.
> 
> Does anyone know what the exact IPTables line would look like to accomplish
> this.  I have never addressed an issue like this with IPTables.

You also would need port 445 as well. Windows machines using file and
printer sharing use ports 137,138,139, and 445.

I'm not sure about the exact syntax at this time, and without knowing
more details about how your network is set up, I can't guess. It
depends on whether your linux machine is acting as a router between
two networks, or if the machines that your computer needs netbios
access to are on the same network. If they are on the same network,
then traffic would be direct from machine A to machine B, and would
not go through IPTABLES.

If machine A and machine B are on separate networks, routed through
the Linux machine, you would probably want to set rules up on your
INPUT chain.

You would need to set up three rules in your IPTABLES.

Rule 1 says to allow traffic from the source machine with a
destination port of 137:139 to be ALLOWED.
Rule 2 says to allow traffic from the source machine with a
destination port of 445 to be ALLOWED.
Rule 3 says to DENY or REJECT all traffic from the source machine.

Since IPTables rules are effective in the order they are written, Rule
1 or 2 would allow the traffic you need, and rule 3 would prevent any
traffic on any other ports from being accepted.

Hope this information is helpful.

David


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux