natcfg.sh: Use iptables for port forwarding, support domain name, ddns, udp, IP, etc.

natcfg.sh: Use iptables for port forwarding, support domain name, ddns, udp, IP, etc.

natcfg.sh, port forwarding based on iptables, features support for domain names, ddns, udp, IP, etc. It is simpler to set up an intranet IP in NAT VPS. The disadvantage is that port segments are not supported.

1. Prerequisite operations are not necessary

1. Uninstall firewalld and ufw

 apt remove firewalld ufw

or

 yum remove firewalld ufw

Then reboot.

2. Install iptables

 yum install -y iptables
yum update iptables 
yum install iptables-services

iptables configuration file: /etc/sysconfig/iptables

3. Enable the forwarding function

 echo -e "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
sysctl -p

4. Set up the iptable automatic loading rules function at startup

CentOS systems:

 service iptables save
systemctl enable iptables.service

Debian/Ubuntu systems:

 iptables-save > /etc/iptables.up.rules
echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules' > /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables

2. Forwarding using natcfg.sh

Under SSH:

 wget --no-check-certificate -qO natcfg.sh https://zhujiwiki.com/wp-content/uploads/2020/11/natcfg/natcfg.sh && bash natcfg.sh

To continue setting, execute

 bash natcfg.sh

3. Uninstall natcfg.sh

 wget --no-check-certificate -qO natcfg.sh https://zhujiwiki.com/wp-content/uploads/2020/11/natcfg/dnat-uninstall.sh && bash dnat-uninstall.sh

4. Configuration File

 /etc/dnat/conf

The project has been open source: https://github.com/arloor/iptablesUtils

<<:  Kuai Che Dao: Double 11 discount, Taiwan HiNet fixed/floating IP all 58 off, plus 1C1G for free

>>:  TabbyCloud: port forwarding, nodes include Guangdong Mobile, Anhui Mobile, Henan Unicom, etc.; 200Mbps bandwidth, 100GB monthly traffic, monthly payment 9.9 yuan

Recommend

Domain name registrar Name.com offers .COM domains for only $9.99 for two years

Haha, you don’t need a discount code, just choose...

DeployNode: $11/year/1GB memory/35GB space/1TB traffic/OpenVZ/France

DeployNode, an Indian hosting provider, was estab...

YZPanel: Chinese VPS Control Panel

What is YZPanel(YZHCP)? YZPanel (YZHCP) is based ...

VPSDime: $7/year/1GB memory/10GB SSD space/1TB traffic/1Gbps port/OpenVZ/Dallas

vpsdime, which has been introduced before, is a v...

Sentris: $16/month/Xeon X3470/8GB memory/1TB hard drive/Seattle

Sentris, has two special priced servers in Seattl...

C38: $2/month/1GB memory/100GB space/1TB traffic/KVM/Canada

C38, claims to have 15 years of experience in the...