About
Pricing
Community
Teams
Start Free Trial
Log in
MatthewF
asked on
3/13/2012
How to make iptables to allow only certain IP's addresses
How do config iptables to allow only certain IP's addresses
Linux Networking
Linux
5
1
Last Comment
dubeyrupesh
8/22/2022 - Mon
legolasthehansy
3/13/2012
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.20
0 to access ssh port 22,
iptables -A INPUT -p tcp --destination-port 22 -m iprange --src-range 192.168.1.100-192.168.1.20
0 -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
ASKER CERTIFIED SOLUTION
farzanj
3/13/2012
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
MatthewF
3/13/2012
ASKER
I want to allow access to all protocol put only server ip addresses
farzanj
3/13/2012
If you see my rules, I am not restricting on protocols. For all protocols as I said, don't mention the protocol part
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
dubeyrupesh
3/13/2012
check
iptables -L
for see the ip tables using
For example to allow ip's in the range of 192.168.1.100-192.168.1.20
iptables -A INPUT -p tcp --destination-port 22 -m iprange --src-range 192.168.1.100-192.168.1.20
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