天天看點

内網伺服器通過能通路公網的伺服器進行上網,搭建VPC專有網絡NAT網關,配置SNAT和DNAT規則項目場景:問題描述:遇到的錯誤及解決方案:

項目場景:

參考:https://developer.aliyun.com/article/607330?spm=5176.smartservice_service_chat.0.0.4bd4709aFRFsjx

侵權聯系删除

問題描述:

阿裡雲有兩台雲伺服器,一台是centos7,一台Windows,隻有centos7有公網ip通路網際網路,Windows沒有,想在Windows上也通路網際網路。需要搭建VPC專有網絡NAT網關,配置SNAT和DNAT規則,由于遇到上面參考的一些問題,在這記錄一下

遇到的錯誤及解決方案:

文章中提到的

VPC的IP段

指的是這個

内網伺服器通過能通路公網的伺服器進行上網,搭建VPC專有網絡NAT網關,配置SNAT和DNAT規則項目場景:問題描述:遇到的錯誤及解決方案:

執行

service iptables save

的時候提示

The service command supports only basic LSB actions (start, stop, restart, try-restart, reload, force-reload, status). For other actions, please try to use systemctl.
           

但是執行

systemtcl iptables save

時候出現

iptables

不存在那就下載下傳

首先停止防火牆

systemctl stop firewalld
           

然後安裝iptables-services

yum install iptables-services
           

設定開機啟動防火牆

systemctl enable iptables
           

可以使用下面指令管理iptables

systemctl [stop|start|restart] iptables
           

然後重新執行

iptables -t nat -I POSTROUTING -s VPC的IP段 -j SNAT --to-source 有公網IP的ECS内網IP

service iptables save

(注意不是systemctl)即可

繼續閱讀