-2

I am hosting a teamspeak 3 server on a dedi-box and I want to be apple to connect to the server with multiple IP's that's IP's is a different VPS's for example :


VPS-1 --> dedi-server

VPS-2 --> dedi-server

VPS-3 --> dedi-server

etc.


I have made it work when I use 1 VPS only, because I bind the teamspek 3 server to a local GRE IP ( in the dedi-server ) so is there a way to make the other VPS's work too? I will make it more clear if I give you the commands I use to do that:


iptunnel add gre1 mode gre local [dedi-public-ip] remote [VPS-1-Public-IP] ttl 255
ip addr add 192.168.168.2/30 dev gre1
ip link set gre1 up
iptunnel add gre2 mode gre local [dedi-public-ip] remote [VPS-2-Public-IP] ttl 255
ip addr add 192.168.10.2/30 dev gre2
ip link set gre2 up
echo '100 AAA' >> /etc/iproute2/rt_tables
ip rule add from 192.168.10.0/30 table AAA
ip route add default via 192.168.10.1 table AAA 
echo '100 BUYVM' >> /etc/iproute2/rt_tables
ip rule add from 192.168.168.0/30 table BUYVM
ip route add default via 192.168.168.1 table BUYVM 

I used this tutorial to do it : http://wiki.buyvm.net/doku.php/gre_tunnel


I think that if I can route the traffic from GRE-1 to GRE-2 or whatever I just want all VPS's works.

Note : when I execute this command :

ip route add default via 192.168.168.1 table BUYVM

This made the VPS-1 allow me to connect to the teamspeak server that's already binded to this IP : 192.168.168.2

dragosht
  • 3,237
  • 2
  • 23
  • 32
AdMiRaL
  • 1
  • 1

1 Answers1

0

I suggest you to add "tos inherit" to ip tunnel commands. This might be not supported in "iptunnel" utility, which is greatly outdated. Use "ip tunnel".

Your RPDB configuration is incorrect. Tables are differentiated in kernel by their number, kernel doesn't know anything about names in rt_tables. These names are only for userspace "ip" utility. You created two aliases for the same table 100, instead of creating two routing tables. If you want to use RPDB features, use different numbers for them instead, like this:

echo '100 AAA' >> /etc/iproute2/rt_tables
echo '200 BUYVM' >> /etc/iproute2/rt_tables

note you have to remove wrong lines from rt_tables file first.

Second, your RPDB rules have to use public addresses of VPS, not GRE-internal addresses. I.e. configuration for each Nth "white" (public) IP should look like this:

echo "20N local-N" >> /etc/iproute2/rt_tables
ip tunnel add mode gre remote WHITE-REMOTE local WHITE-LOCAL-N tos inherit
ip addr add VPN-LOCAL-N/30
ip route add default via NEXTHOP-N table local-N
ip rule add from WHITE-LOCAL-N lookup local-N

Substitute N for IP number, WHITE-LOCAL-N - Nth public IP address assigned to multihomed host, NEXTHOP-N - default gateway for Nth ip.

If all addresses are from a single network and you assigned them to same interface, (say, they assigned you 192.0.2.6, 192.0.2.15 and 192.0.2.66), and you have only one default gateway (say, it could be 192.0.2.1), you don't need RPDB at all.