(reprint) iptables forwarding Oracle Port

Source: Internet
Author: User

This article is from the "Township had sex ren" blog, please be sure to keep this source http://shaowu.blog.51cto.com/627407/514909

Project team colleagues need to forward SQL requests to another server, so this feature is implemented through Iptables

 [[Email protected]1  ~]# echo  1  > Proc/sys/net/ipv4/ip_forward[[email  protected] -1  ~]# iptables-t nat-a prerouting-d 192.168 . 18.19 -P TCP--dport 1521 -j DNAT--to 192.168 . 4.74 : 1521  [[email protected] -192.168 . 4.74 -P TCP--dport 1521 -j SNAT--to 192.168 . 18.19  

To view NAT rules:

[[Email protected]1~]# iptables-l-N-T Natchain prerouting (policy ACCEPT) target prot opt source Destinationdnat TCP--0.0.0.0/0            192.168.18.19TCP DPT:1521To:192.168.4.74:1521Chain postrouting (policy ACCEPT) target prot opt source Destinationsnat TCP--0.0.0.0/0            192.168.4.74TCP DPT:1521To:192.168.18.19Chain OUTPUT (policy ACCEPT) target prot opt source destination

Telnet test:

[Email protected]1192.168. 4.74 1521  192.168. 4.74 ... Connected to localhost (192.168. 4.74  '^]'.

Save Iptables Settings:

[[Email protected]1 ~]# iptables-save >>/etc/sysconfig/iptables

(reprint) iptables forwarding Oracle Port

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.