Jack Posted May 1, 2020 Share Posted May 1, 2020 (edited) --------------------------------------------------- 阿里雲、騰訊雲這些大廠有內網IP、公網IP --------------------------------------------------- 如果沒修改以下設置 在某些程式(例如IPS論壇)運行下,你會發現速度變慢了 查看網卡 /sbin/ifconfig 你在這裡看不到公網IP 需要設置一張網卡,新網卡名稱為 eth0:0 例如: (公網IP) 47.1.1.1 (內網IP) 172.2.2.2 指令 cd /etc/sysconfig/network-scripts vi ifcfg-eth0:0 複製貼上這幾行並改為你的公網IP DEVICE=eth0:0 BOOTPROTO=none ONPARENT=yes IPADDR=你的公網IP NETMASK=255.255.255.0 ONBOOT=yes 儲存並離開 :wq 敲指令 iptables -t nat -A POSTROUTING -s 你的公網IP -j SNAT --to-source=你的內網IP 儲存防火牆規則 service iptables save 正常情況是顯示 iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ] 如果有錯誤,代表沒有iptables防火牆 如果你是用firewalld防火牆,需要改一下 重開機 reboot SSH登入 查看網卡,看看公網IP有沒有設置上 /sbin/ifconfig 會看到eth0:0這張網卡 Edited May 8, 2020 by Jack Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now