In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article focuses on "how to achieve Linux secure iptables port forwarding". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "how to achieve Linux secure iptables port forwarding".
1. The system turns on routing forwarding
Echo 1 > / proc/sys/net/ipv4/ip_forward
Sysctl-p
two。 Rule settin
# iptables-t nat-A PREROUTING-p tcp-- dport 2201-j DNAT-- to-destination 10.6.1.114
# iptables-t nat-A POSTROUTING-p tcp-s 10.6.1.114-sport 22-j SNAT-- to-source 42.162.6.44 tcp 2201
The four tables of iptables are:
Filter (filtering): packet filtering / blocking, which can include three built-in chain: INPUT, FORWARD, and OUTPUT.
Nat (address translation): IP address or port number translation, which can include three built-in chain,nat table, PREROUTING, OUTPUT, and POSTROUTING. The corresponding relationship of translation will be recorded when the session is established, and the return packets and subsequent messages of the same session will be automatically translated. This is because nat uses ip_conntrack module.
Mangle (package Management): used to modify IP messages, including PREROUTING, OUTPUT, INPUT, FORWARD, POSTROUTING 5 built-in chain.
Raw: this table takes precedence over ip_conntrack modules and other table, and is mainly used to exclude packets from session-state connections (such as tcp). Can include POSTROUTING, OUTPUT two built-in chain.
At this point, I believe you have a deeper understanding of "how to achieve Linux secure iptables port forwarding". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.