how to prevent IPs access to my server

preleaf

Well-Known Member
Aug 25, 2004
84
0
156
how to prevent IPs access to my server Can I prevent some IPs access to my server .Example :these IPs start 203.x.x.x or 205.x.x.x
Please ,guide me step by step
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
31
473
Go on, have a guess
Again, if you search for the term "firewall" you'll get plenty of options, the most popular would be to install APF (an iptables based firewall).
 

preleaf

Well-Known Member
Aug 25, 2004
84
0
156
please ,guide me

as follow the manual I am know in file allow_host.rules to allow host access to server as this :x.x.x.x/24.But how to permit these IPs start by 205 or 203 .So I can add this line:
205.x.x.x/24 that i dont replace x.x.x cant I?Because I dont want to THESE IPs START 205 or 203
 

linux-image

Well-Known Member
Jun 8, 2004
1,190
1
168
India
cPanel Access Level
Root Administrator
iptables -A INPUT -s 205.0.0.0/24 -j DROP

iptables -A INPUT -s 203.0.0.0/24 -j DROP

that will do.
 

preleaf

Well-Known Member
Aug 25, 2004
84
0
156
what are file add 2 that lines ?allow_host.rules or conf.apf?where are add 2 lines ?thanks!
 

linux-image

Well-Known Member
Jun 8, 2004
1,190
1
168
India
cPanel Access Level
Root Administrator
just type that on your shell; and then

/etc/rc.d/init.d/iptables save

that will do.
 

preleaf

Well-Known Member
Aug 25, 2004
84
0
156
Hi linux-image,
i typed :
[email protected][~]# iptables -A INPUT -s 205.0.0.0/24 -j DROP

[email protected][~]#iptables -A INPUT -s 203.0.0.0/24 -j DROP
when permit IPs start 205 then these IPs cant login by root but it still access websites onmy server by browser