Blog
Projects
About
Backtrack:
Blog
›
iptables: block traffic from/t…
Comments
iptables: block traffic from/to a specific IPv4 address
posted on September 13th 2019, at 10:55
by
lunarg
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
...
read more
add a comment
Tags
computer
software
windows
vmware
microsoft
linux
exchange
network
hardware
news
mac
home
powershell
office365
msoffice
server
sqlserver
dell
ad
soaring
internet
esx
rds
sbs
mssql
events
terminalserver
powercli
hp
virtualization
Archive
«
‹
January 2023
›
»
Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Links
-
@harkx
-
Cats & Dogs
-
Jargon-free Security Guide
Quote
«
Stripes on a tiger are hard to change.
»
The Noisettes
Contact
© 2009-2023 Black Manticore – all rights reserved
code by
lunarg
, design by
SuriAmanah
, hosted at Cats&Dogs