In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the example analysis of Linuxnat port conversion for you. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.
[1] goal
The machines of the public network segment 192.168.123.0 access the target machine CentOS65--192.168.100.65 through the springboard machine
[2] configuration description
CentOS69: springboard machine
Eth0--192.168.123.69 (public network address)
Eth2--192.168.100.69 (private network address)
CentOS65: target machine (real Server machine)
Eth2--192.168.100.65 (private network address)
[3] step instructions
1) set kernel parameters
Echo 1 > / proc/sys/net/ipv4/ip_forward
Sysctl-w net.ipv4.ip_forward = 1
2) set IPTABLE chain
Iptables-P FORWARD ACCEPT
Iptables-P OUTPUT ACCEPT
Iptables-P INPUT ACCEPT
3) set the accepted port
Iptables-An INPUT-p tcp-m state-- state NEW-m tcp-- dport 22000-j ACCEPT
4) set PREROUTING chain
Iptables-t nat-A PREROUTING-- dst 192.168.123.69-p tcp-- dport 22000-j DNAT-- to-destination 192.168.100.65fre22
5) set POSTROUTING chain
Iptables-t nat-A POSTROUTING-- dst 192.168.100.65-p tcp-- dport 22-j SNAT-- to-source 192.168.100.69
6) set FORWARD chain
Iptables-I FORWARD-d 192.168.100.65-p tcp-- dport 222j ACCEPT
-d 192.168.100.65 destination machine address
-- dport 222Target Machine Port
Set the forward chain to allow you to jump to the IP address and port of the target machine
7) restart iptables
Service iptables restart
8) Save the firewall configuration
Service iptables save
9) access method
Access the private network machine from the public network address
Ssh-p 222 192.168.123.69
This is the end of the case analysis of Linuxnat port conversion. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.