Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to make iptables to allow only certain IP's addresses

Posted on 2012-03-13
5
Medium Priority
?
399 Views
Last Modified: 2012-03-14
How do config iptables to allow only certain IP's addresses
0
Comment
Question by:MatthewF
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Expert Comment

by:legolasthehansy
ID: 37716506
What is it you are looking for? Are you looking to allow only certain ip addresses to access certain ports or services?

For example to allow ip's in the range of 192.168.1.100-192.168.1.200 to access ssh port 22,

iptables -A INPUT -p tcp --destination-port 22 -m iprange --src-range 192.168.1.100-192.168.1.200 -j ACCEPT

Here is a nice how-to for a start..

http://www.cyberciti.biz/tips/linux-iptables-how-to-specify-a-range-of-ip-addresses-or-ports.html
0
 
LVL 31

Accepted Solution

by:
farzanj earned 1900 total points
ID: 37716519
What is your Linux distribution?

Make sure iptables service is running.

Issue this commands
iptables -A INPUT  -s 192.168.0.254 -j ACCEPT
iptables -A INPUT -s 0/0 -j DROP 

Open in new window

0
 

Author Comment

by:MatthewF
ID: 37717330
I want to allow access to all protocol put only server ip addresses
0
 
LVL 31

Expert Comment

by:farzanj
ID: 37718007
If you see my rules, I am not restricting on protocols.  For all protocols as I said, don't mention the protocol part
0
 

Expert Comment

by:dubeyrupesh
ID: 37718442
check
iptables -L
for see the ip tables using
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Suggested Courses

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question