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

QuickPacket - Provides cost-effective dedicated servers

QuickPacket was founded in 2003 with a PR of 2. I...

definedcodehosting: €2/year/64MB RAM/3GB space/50GB bandwidth/OpenVZ

Definedcodehosting is a hosting company that has ...

AlphaRacks: Black Friday deals, great deals (web hosting, reseller hosting, vps)

AlphaRacks, Host Encyclopedia owns a VPS with goo...

Treudler 256MB RAM German KVM VPS Review

Details: Treudler: €9/year/256MB memory/5GB SSD s...

HostUnmetered: €175/month/E3-1230/8GB RAM/2TB HDD/10TB bandwidth/Tokyo, Japan

HostUnmetered, a British hosting provider, is a c...

Rebel Hosting: $19/month/8GB RAM/120GB hard drive/10TB bandwidth/California

Rebel Hosting, a US hosting provider, registered ...

Dracula Servers: $5/month/2GB RAM/15GB SSD space/500GB bandwidth/KVM/Chicago

Dracula Servers is a foreign hosting company esta...

RAKsmart 512MB RAM San Jose KVM VPS Review

Details: RAKsmart: 9.9 yuan/month/512MB memory/20...

WootHosting 4GB RAM Miami OpenVZ VPS Review

Details: WootHosting: $19/year/2GB memory/50GB sp...