获取root权限:
sudo -i
Ubuntu系统下:
开放所有端口
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
国内机器
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
脚本执行以后会出现以下画面
连接成功
[root@vm619974 ~]# wget -qO natcfg.sh http://arloor.com/sh/iptablesUtils/natcfg.sh && bash natcfg.sh
用途: 便捷的设置iptables端口转发
注意1: 到域名的转发规则在添加后需要等待2分钟才会生效,且在机器重启后仍然有效
注意2: 到IP的转发规则在重启后会失效,这是iptables的特性
你要做什么呢(请输入数字)?Ctrl+C 退出本脚本
1) 增加到域名的转发 3) 增加到IP的转发 5) 列出所有到域名的转发
2) 删除到域名的转发 4) 删除到IP的转发 6) 查看iptables转发规则
这里可以转发域名或IP,并可以转发多个,我们这里以域名为例!选择输入1 增加到域名的转发
#? 1
本地端口号:35223 // 这里的端口号是这台中转机器上所需要使用的端口号。注意防火墙请放行这个端口号,请更改成你所使用的端口号!
远程端口号:41000 // 这里的端口号输入垃圾VPS上v2ray或trojan所使用的端口号,请改成你的!
目标域名:name.com // 这里是你解析到垃圾VPS上所使用的域名,请输入你的域名
输入完以后回车会有如下提示:
成功添加转发规则 35223>name.com:41000 大约两分钟后规则会生效
这样转发就已经成功!回到你v2ray或trojan客户端,改下里面的信息把域名改成这台中转机的IP就行,其他不用变!若要转发ip操作一样只是把域名换ip,并可添加多个转发!
BBR 加速
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
防火墙解除
centos操作如下:
#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
#关闭iptables
service iptables stop
#去掉iptables开机启动
chkconfig iptables off
oracle Linux操作如下:
#停止firewall
systemctl stop firewalld.service
#禁止firewall开机启动
systemctl disable firewalld.service
ubuntu操作如下:
#Oracle自带的Ubuntu镜像默认设置了Iptable规则,关闭它
apt-get purge netfilter-persistent
reboot
#强制删除
rm -rf /etc/iptables && reboot
评论区