I have a linux machine without iptables running and we have a new requirement to block a remote machine ( IP = 172.1.1.1 ) completely accessing our linux machine in both directions. So I need to allow "everything" except that IP address. So i tried below:
If I set the below in /etc/sysconfig/iptables file and do service iptables restart then everything is allowed (included the blocked IP)
If I try the below then it blocks everything
I'm new to iptables and not sure what am I doing wrong, appreciate if any expert could help me out here please
Thanks, that seems to have solved my prob but i need more tests to do to ensure. Is there any tool or software or anything that can help me setup iptables easily? somehow I find iptables very uncomfortable
In order to block an IP on your Linux server you need to use iptables tools (administration tool for IPv4 packet filtering and NAT) and netfilter firewall. First you need to log into shell as root user. To block an IP address you need to type the iptables command as follows:
Syntax to block an IP address under Linux
Replace IP-ADDRESS with your actual IP address. For example, if you wish to block an ip address 65.55.44.100 for whatever reason then type the command as follows:
If you have IP tables firewall script, add the above rule to your script.
If you just want to block access to one port from an ip 65.55.44.100 to port 25 then type command:
The above rule will drop all packets coming from IP 65.55.44.100 to port mail server port 25.
CentOS / RHEL / Fedora Block An IP And Save It To Config File
Type the following two command:
Moderator's Comments:
Use code tags, thanks.
Last edited by zaxxon; 11-06-2015 at 03:55 AM..
Reason: code tags
Hi
I am looking to block an incomming IP for all the subnet in lab area. Only single Ip from Lab should be access to this incomming IP.
Block IP=10.20.50.xx
Subnet=10.30.40.xx
............................
...........................
Subnet=10.40.50.xx
can anyone explain how to do... (2 Replies)
I have 2 LAN's, seperated by a firewall, running iptables on it.
I want only allow ftp access from one to the other LAN.
Server 1 in LAN 1 should have ftp access to Server 2 in LAN 2
Server 2 in LAN 2 should not have ftp access to Server 1 in LAN 1.
Can someone tell me how to set up the... (5 Replies)