Sponsored Content
Operating Systems Linux How to block only one IP using iptables? Post 302958361 by magnus29 on Wednesday 21st of October 2015 01:29:47 PM
Old 10-21-2015
How to block only one IP using iptables?

Hi friends,

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)

Code:
# Default IPtables config
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [26:8868]

-A INPUT -j ACCEPT
-A OUTPUT -j ACCEPT

-A INPUT --src 172.1.1.1 -j REJECT
-A OUTPUT --dst 172.1.1.1 -j REJECT

COMMIT

If I try the below then it blocks everything

Code:
# Default IPtables config
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT DROP [26:8868]

-A INPUT --src 172.1.1.1 -j REJECT
-A OUTPUT --dst 172.1.1.1 -j REJECT

-A INPUT -j ACCEPT
-A OUTPUT -j ACCEPT


COMMIT

I'm new to iptables and not sure what am I doing wrong, appreciate if any expert could help me out here please Smilie
 

2 More Discussions You Might Find Interesting

1. Cybersecurity

iptables: block/allow ftp

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)
Discussion started by: sTorm
5 Replies

2. Red Hat

Block an IP for a subnet by iptables

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)
Discussion started by: boby.kumar
2 Replies
DROP 
TABLESPACE(7) SQL Commands DROP TABLESPACE(7) NAME
DROP TABLESPACE - remove a tablespace SYNOPSIS
DROP TABLESPACE [ IF EXISTS ] tablespacename DESCRIPTION
DROP TABLESPACE removes a tablespace from the system. A tablespace can only be dropped by its owner or a superuser. The tablespace must be empty of all database objects before it can be dropped. It is possible that objects in other databases might still reside in the tablespace even if no objects in the current database are using the tablespace. Also, if the tablespace is listed in the temp_tablespaces setting of any active session, the DROP might fail due to temporary files residing in the tablespace. PARAMETERS
IF EXISTS Do not throw an error if the tablespace does not exist. A notice is issued in this case. tablespacename The name of a tablespace. NOTES
DROP TABLESPACE cannot be executed inside a transaction block. EXAMPLES
To remove tablespace mystuff from the system: DROP TABLESPACE mystuff; COMPATIBILITY
DROP TABLESPACE is a PostgreSQL extension. SEE ALSO
CREATE TABLESPACE [create_tablespace(7)], ALTER TABLESPACE [alter_tablespace(7)] SQL - Language Statements 2010-05-14 DROP TABLESPACE(7)
All times are GMT -4. The time now is 01:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy