Solved

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

Posted on 2012-03-13
5
395 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 475 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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

617 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