Map the IP address on the VPS to the dedicated server through IPIP tunneling

Map the IP address on the VPS to the dedicated server through IPIP tunneling

Given that some service providers will launch very cheap servers, but limit the number of independent IPs that can be purchased.
However, you can purchase a lot of independent IP addresses for your own VPS at a relatively cheap price.
Here, I will introduce to you a tutorial on how to map the IP of a VPS to a dedicated server.
The VPS system used in this tutorial is Debian 7, and the system of the independent server is Ubuntu 16.04.

1. Add an IP address on the VPS :
Edit the file /etc/network/interfaces. If the network card corresponding to the default IP is eth0, add a new network card eth0:0 and add the following:

 auto eth0:0 iface eth0:0 inet static address VPS_EXTRA_IP netmask 255.255.255.255

Replace VPS_EXTRA_IP with the IP address that needs to be mapped to your dedicated server. If there are multiple IPs, add them one by one.
After saving, execute ifup eth0:0 to activate the new IP. After completion, please ping the IP address to be mapped from the independent server to see if it can be pinged.

2. Enable forwarding :
Edit the /etc/sysctl.conf file of the VPS and set;

 net.ipv4.ip_forward=1

Save and exit after editing. and make it effective.

 sysctl -p

3. Set up IPIP tunnel :
Execute on the VPS in sequence;
Note: Replace Dedicated_Servers_IP with the address of your dedicated server.

 iptunnel add shc mode ipip local VPS_EXTRA_IP remote Dedicated_Servers_IP ttl 255 ip addr add 192.168.100.1/30 dev shc ip link set shc up

Then execute on the standalone server in sequence:

 iptunnel add shc mode ipip local Dedicated_Servers_IP remote VPS_EXTRA_IP ttl 255 ip addr add 192.168.100.2/30 dev shc ip link set shc up

4. Set up routing table and mapping :
Execute on the VPS:

 iptables -t nat -A POSTROUTING -s 192.168.100.0/30 -j SNAT --to-source VPS_EXTRA_IP iptables -t nat -A PREROUTING -d VPS_EXTRA_IP -j DNAT --to-destination 192.168.100.2 iptables -A FORWARD -d 192.168.100.2 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

Execute on a standalone server:

 echo '100 SHC' >> /etc/iproute2/rt_tables ip rule add from 192.168.100.0/30 table SHC ip route add default via 192.168.100.1 table SHC

At this point, IP mapping is set up.

via:newbug.top

<<:  FlowVPS: $3.6/month/2GB memory/15GB NVMe space/250GB traffic/KVM/Australia

>>:  NFPHosting: $15/year/1GB memory/20GB space/1.5TB traffic/KVM/Los Angeles/New York/Chicago

Recommend

Free domain name resolution - dnsExit

dnsExit is an American network provider that prov...

Hong Kong, Taiwan, and Macau merchants with high bandwidth of 50Mbps and above

For reference: Japan, South Korea, Singapore, and...

Dnsever.com —— Free domain name resolution provider in South Korea

Dnsever.com is a Korean website that launched a f...

D9 Hosting OpenVZ VPS 12% off lifetime discount

I bought it from http://www.whcoupon.com/54.html....

Fallout-Hosting: $30/month/E3-1230/16GB RAM/120 GB SSD/10TB bandwidth/Dallas

Fallout-Hosting is an American hosting company th...

BurstNet latest discount code

Everyone should know the name of BurstNet. If you...

PQ.hosting 1GB RAM 1Gbps port unlimited traffic Ukraine KVM VPS review

Details : PQ.hosting: €1/month/1GB RAM/15GB SSD s...

Install OpenVZ and configure OpenVZ Web Panel in CentOS

Note: This tutorial is based on a KVM-based VPS o...

Cloudflexy 1GB RAM Los Angeles OpenVZ VPS Review

Details: Cloudflexy: $11.88/year/1GB RAM/30GB SSD...

PremiumReseller: $9.95/month/20G storage/200G traffic/unlimited cPanel/Singapore

PremiumReseller is a foreign hosting company foun...