国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 基礎常識 > 正文

CentOS系統中使用iptables設置端口轉發

2020-03-01 06:39:56
字體:
來源:轉載
供稿:網友

  將本地接口IP 61.144.14.72 的3389端口 轉發到 116.6.73.229的3389

  (主要訪問到61.144.14.72的3389端口,就會跳轉到116.6.73.229的3389)

  【步驟】

  1、 首先應該做的是/etc/sysctl.conf配置文件的 net.ipv4.ip_forward = 1 默認是0 這樣允許iptalbes FORWARD。

  2、 service iptables stop 關閉防火墻

  3、 重新配置規則

  iptables -t nat -A PREROUTING --dst 61.144.14.72 -p tcp --dport 3389 -j DNAT --to-destination 116.6.73.229:3389

  iptables -t nat -A POSTROUTING --dst 116.6.73.229 -p tcp --dport 3389 -j SNAT --to-source 61.144.14.72

  service iptables save

  將當前規則保存到 /etc/sysconfig/iptables

  若你對這個文件很熟悉直接修改這里的內容也等于命令行方式輸入規則。

  5、 啟動iptables 服務, service iptables start

  可以寫進腳本,設備啟動自動運行;

  # vi /etc/rc.local

  #!/bin/sh

  #

  # This script will be executed *after* all the other init scripts.

  # You can put your own initialization stuff in here if you don't

  # want to do the full Sys V style init stuff.

  touch /var/lock/subsys/local

  sh /root/myshipin.log

  ---------------------------------------------------------------------

  vi myshipin.log

  #!/bin/sh

  #

  # This script will be executed *after* all the other init scripts.

  # You can put your own initialization stuff in here if you don't

  # want to do the full Sys V style init stuff.

  iptables -F -t nat iptables -t nat -A PREROUTING --dst 61.144.14.72 -p tcp --dport 3389 -j DNAT --to-destination 116.6.73.229:3389

  iptables -t nat -A POSTROUTING --dst 116.6.73.229 -p tcp --dport 3389 -j SNAT --to-source 61.144.14.72

  ~

  ----------------------------------------------------------------

  TCP

  iptables -t nat -A PREROUTING --dst 61.144.14.87 -p tcp --dport 9304 -j DNAT --to-destination 10.94.143.204:9304

  iptables -t nat -A POSTROUTING --dst 10.94.143.204 -p tcp --dport 9304 -j SNAT --to-source 61.144.14.87

  UDP

  iptables -t nat -A PREROUTING --dst 61.144.14.87 -p udp --dport 9305 -j DNAT --to-destination 10.94.143.204:9305

  iptables -t nat -A POSTROUTING --dst 10.94.143.204 -p udp --dport 9305 -j SNAT --to-source 61.144.14.87

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 惠水县| 通州市| 贺兰县| 吉木萨尔县| 淅川县| 马尔康县| 揭西县| 辽阳县| 镇宁| 河北区| 阿尔山市| 万载县| 嫩江县| 建湖县| 新宾| 邵阳市| 南汇区| 柯坪县| 包头市| 天津市| 神池县| 阆中市| 都兰县| 阿拉善右旗| 犍为县| 高尔夫| 浦江县| 土默特左旗| 库伦旗| 东阳市| 运城市| 阿尔山市| 昭通市| 铜陵市| 淮北市| 井陉县| 浦县| 独山县| 白山市| 武义县| 霍州市|