LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-22-2024, 10:58 AM   #1
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Rep: Reputation: 10
Post Accepting connections from a specified range of IP addresses


Hello,
I have a Tor server with IP address 172.20.1.100 and I want only IP addresses in the range 172.20.1.0/24 to be able to connect to it. Is the following iptables rule correct?
Code:
iptables -A INPUT -p tcp -s 172.20.1.0/24 --dst 172.20.1.100 --dport 9050 --jump ACCEPT
Thank you.
 
Old 01-22-2024, 11:29 AM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 777

Rep: Reputation: 244Reputation: 244Reputation: 244
Why not set it with SocksPolicy in torrc? If you are going to use Iptables, consider the default POLICY. If you default allow, that does nothing and you'll need a DROP (or log/drop) right after it. You don't need the dst.
 
Old 01-22-2024, 11:59 AM   #3
Jason.nix
Member
 
Registered: Feb 2023
Posts: 561

Original Poster
Rep: Reputation: 10
Lightbulb

Quote:
Originally Posted by jayjwa View Post
Why not set it with SocksPolicy in torrc? If you are going to use Iptables, consider the default POLICY. If you default allow, that does nothing and you'll need a DROP (or log/drop) right after it. You don't need the dst.
Hello,
Thank you so much for your reply.
I did:
Code:
SOCKSPort 172.20.1.100:9050
I know I can do this with SocksPolicy, but I want to do it with iptables. Do you mean all following policies should be DROP?
Code:
*filter
:INPUT ACCEPT [862:113997]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [76190:79547849]
If I change INPUT to DROP, can clients connect to the server?
Why is dst not needed?
 
  


Reply



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
squid drops connections to ip addresses, but allows connections to domain names igoryonya Linux - Networking 4 11-07-2014 05:10 PM
squid drops connections to ip addresses, but allows connections to domain names igoryonya Linux - Networking 2 11-06-2014 10:33 PM
Accepting connections to IP and Mac addresses warrenscorgie Linux - Networking 4 12-02-2010 01:55 AM
SMB not accepting specified crudentials DrakIE Linux - Networking 1 04-07-2004 03:34 PM
FTPd has stop accepting connections shiny heed Linux - General 1 05-02-2003 06:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:40 AM.

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