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

Vpsfast: $5/month/1GB memory/40GB space/2TB traffic/KVM/Los Angeles

Vpsfast.Us, a US hosting provider, provides up to...

Webhostpython: $9.99/month/120GB space/unlimited traffic/unlimited domain names

Webhostpython is a US hosting provider that provi...

Zare: £30/month/E3-1231v3/16GB RAM/240GB SSD/20TB bandwidth/DDoS/UK

Zare, a British hosting provider, was established...