說(shuō)明:一般用海外服務(wù)器的都會(huì)遇到線路爆炸,網(wǎng)絡(luò)不好的情況,導(dǎo)致我們用的效果很差,這時(shí)候就可以用端口轉(zhuǎn)發(fā)來(lái)改善這種情況,常見的轉(zhuǎn)發(fā)有rinetd、Haproxy、iptables、socat,前面2種只能轉(zhuǎn)發(fā)TCP,后面TCP/UDP都可以轉(zhuǎn)發(fā),如果用來(lái)玩游戲的話就需要轉(zhuǎn)發(fā)UDP了。
1.下載Centos源:
http://mirrors.aliyun.com/centos/7/isos/x86_64/.
2.安裝centos7
3.關(guān)閉firewalld防火墻
systemctl stop firewalld.service
systemctl disable firewalld.service
4.安裝wget
yum -y install wget
5.編輯網(wǎng)卡
vi /etc/sysconfig/network-scripts/ifcfg-ens3
編輯 ONBOOT=yes
6.安裝一鍵腳本
wget --no-check-certificate -qO natcfg.sh http://www.arloor.com/sh/iptablesUtils/natcfg.sh && bash natcfg.sh
wget --no-check-certificate -qO natcfg.sh https://raw.githubusercontent.com/arloor/iptablesUtils/master/natcfg.sh && bash natcfg.sh
7.設(shè)置本地/目的端口 目的服務(wù)器ip即可。
8.保存
service iptables save
執(zhí)行這個(gè)命令的時(shí)候有時(shí)候可能會(huì)報(bào)錯(cuò):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.
這是因?yàn)闆](méi)有安裝iptables服務(wù),直接使用yum安裝iptables服務(wù)即可.
yum install iptables-services
安裝完成后,重新執(zhí)行 service iptables save 命令即可保存成功。
9.配置iptables開機(jī)自啟
保存后重啟依然沒(méi)有生效,后百度得知,需要設(shè)置iptables開機(jī)自啟才可使配置生效。
執(zhí)行如下命令(老版本命令為:service iptables on),設(shè)置iptables開機(jī)自啟
systemctl enable iptables.service
學(xué)習(xí)了
留言是種美德,寫點(diǎn)什么…