-1

Good day!

I have 2 servers in datacenter and I want to use one of them as router for another instead of default gateway provided by DC. Both servers have one ethernet interface called 'eth0' with public IPv4 and IPv6 addresses and both servers are running Linux. Distributive isn't important, because I can use any: CentOS, Debian, Arch, OpenSUSE etc. Please help to get routing work. I understand that I can build private network with help of tunneling but it looks like overkill.

Also datacenter provides /56 routed to server 1.

Let's say that addresses are distributed as below:

server 1: 139.100.100.1/24, gw 139.100.100.254 2a01:7e00::f03c:dcff:acd0:742c/64

server 2: 139.100.100.2/24, gw 139.100.100.254 2a01:7e00::f03c:dcff:acd0:6124/64

George Gaál
  • 490
  • 3
  • 8
  • Are both servers attached to the same switch? – kasperd May 03 '16 at 23:34
  • Probably yes, but I'm not sure. Please describe both situations. – George Gaál May 03 '16 at 23:36
  • 1
    If both are attached to the same switch, you could probably use a VLAN tag for your "private" segment between the two servers. If they are not on the same switch, or if you simply don't know, then a tunnel is appropriate. – kasperd May 03 '16 at 23:40
  • @kasperd so there is no way to write 'right' routes on both servers without hacks like VLANs or tunnelling to get things work? – George Gaál May 03 '16 at 23:43
  • If both servers are attached to the same Ethernet segment, you could do it by simply writing suitable routing table entries. But **that** would be a hack. – kasperd May 04 '16 at 07:15

1 Answers1

1

You have not stated what the router is supposed to be doing or what speed / memory is available in your servers.

But regardless, these goals can be potentially accomplished using just one of the two servers. It will act as a router for itself, using a VLAN that is restricted to the single device, and which doesn't go to any real physical port.

You would need to set up the hardware with a hypervisor and run the router and server in two separate virtual machines.

Router virtual machine:

  • WAN -> Real ethernet port
  • LAN -> VLAN-10

Server virtual machine:

  • uses a virtual NIC that understands VLANs, and connects to VLAN-10

VLAN-10 has no physical ethernet jack, but will properly pass network traffic between the two virtual machines via the hypervisor's virtual network switch.

Dale Mahalko
  • 755
  • 1
  • 6
  • 17
  • Interesting idea! I like it. Thanks. The only problem that both server are already VPS. I think that they don't have capability of one more virtualization layer. Also if I had bare metal server with hypervisor installed on it I will be able to install Mikrotik CHR into virtual environment and tune it to my needs. – George Gaál May 05 '16 at 11:25