iptables--DNAT

#!/bin/bash

# dnat
#
# 內網服務: 192.168.49.85:80
# 網關: 192.168.49.65
# 請求主機: 172.16.0.129
# 請求過程:
# 172.16.0.129 –> 192.168.49.65 –to-destination 192.168.49.85:8080

iptables -t nat -F
iptables -F

iptables -t nat -A PREROUTING -d 192.168.49.65 -p tcp --dport 80 -j DNAT --to-destination 192.168.49.85:8080

iptables-save > /etc/sysconfig/iptables.dnat
iptables-restore < /etc/sysconfig/iptables.dnat
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章