Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Linux command: iptables
(view source)
Revision as of 10:13, 7 April 2021
259 bytes added
,
10:13, 7 April 2021
m
→Collection of basic Linux Firewall iptables rules
Line 10:
Line 10:
==Collection of basic Linux Firewall iptables rules==
==Collection of basic Linux Firewall iptables rules==
−
=== Redirect connections to service ===
+
===Redirect connections to service===
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
−
# SERVER
sysctl net.ipv4.ip_forward=1
sysctl net.ipv4.ip_forward=1
service networking restart
service networking restart
−
iptables -t nat -A PREROUTING -p tcp --dport <puerto receptor> -j DNAT --to-destination <ip final>:<puerto de ip final>
+
+
#
iptables -t nat -A PREROUTING -p tcp --dport <puerto receptor> -j DNAT --to-destination <ip final>:<puerto de ip final>
+
iptables -t nat -A PREROUTING -p tcp --dport 1081 -j DNAT --to-destination 18.193.226.201:1800
iptables -t nat -A POSTROUTING -j MASQUERADE
iptables -t nat -A POSTROUTING -j MASQUERADE
−
EJ: iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to-destination 10.10.0.2:110
+
#
EJ: iptables -t nat -A PREROUTING -p tcp --dport 110 -j DNAT --to-destination 10.10.0.2:110
+
+
# iptables -L -n -t nat
+
# sudo iptables -L -t nat --line-numbers
+
sudo iptables -t nat -v -L PREROUTING -n --line-number
+
+
# Delete rule
+
# sudo iptables -t nat -D PREROUTING {rule-number-here}
−
iptables -L -n -t nat
</syntaxhighlight>
</syntaxhighlight>
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version