Backtrack:  
 
showing posts tagged with 'iptables'
 
edited by on September 13th 2019, at 10:55
To quickly block traffic from/to a specific IPv4 address using iptables, you can use the commands below.

Warning!
Do not use these commands when you are already running an iptables-based firewall as this may result in unexpected results.

Block incoming traffic from a specific IP:

iptables -A INPUT -s 1.2.3.4 -j DROP

Block outgoing traffic (i.e. traffic initiated from the host itself) to a specific IP:

iptables -A OUTPUT -d 1.2.3.4 -j DROP

To block outgoing traffic to a specific port and protocol, you can also do something like this (the example below blocks DNS and HTTP):

/sbin/iptables -A OUTPUT -p tcp --dport 80 -d 1.2.3.4 -j DROP/sbin/iptables -A OUTPUT -p udp --dport 53 -d 1.2.3.4  ...
 
showing posts tagged with 'iptables'
 
 
« December 2024»
SunMonTueWedThuFriSat
1234567
891011121314
15161718192021
22232425262728
293031    
 
Links
 
Quote
« Most people tend to avoid true conflict. Ironically this breeds more conflict. »