Hetzner - DokuWiki

Vswitch/en

Inhaltsverzeichnis

vSwitch

With the vSwitch feature, Hetzner Online has created a tool for your dedicated root servers that lets you connect your servers in multiple locations to each other using virtual layer 2 networks. On your account on the Robot administration interface, you can create and configure vSwitches using the "vSwitches" button in the server overview.

Vswitch server overview.png

How do I setup a vSwitch?

You can create a vSwitch on Robot by going to "Main functions; Server; vSwitches". Then assign a name and a VLAN ID to your vSwitch. The VLAN ID can range from 4000 to 4091.

Vswitch create.png

After you have created the vSwitch, you can then assign your root servers to the vSwitch using the "Add server" button. Then the servers that you have added can communicate with each other using the VLAN ID that you have set.

The server's main IP address and the additional IP addresses +/or subnets can still be reached without doing VLAN tagging.

Vswitch add server.png

IP addresses

You can use any private IP addresses for free within the VLAN. Plus, you can order additional public subnets (IPv4 and IPv6) by going to the "IPs" menu tab. You can use these subnets on all servers that you assign to your vSwitch.

public VLAN subnet usable IPs
monthly fee
IPv4 subnet /29
5 € 15.13
IPv4 subnet /28
13 € 21.85
IPv4 subnet /27
29 € 35.29
IPv6 subnet /64
2^64 € 8.40

Traffic

Internal traffic (across locations) is free of charge. For the public subnets, vSwitches have an included traffic limit of 1TB per month. Each additional TB costs € 1.00 €/month (excl. VAT). The basis for calculation is for outgoing traffic only.

Firewall

The servers' firewall is also applied to the packets of the vSwitches. Please note that if you have activated a firewall, you must also enable internal IP addresses in the firewall.

Server configuration (Linux)

For the vSwitch, you need to configure an interface with the VLAN ID that you have entered on Robot. You should limit the MTU of the interface to 1400.

Example configuration for the network card "enp0s31f6", with the VLAN ID 4000

Create a VLAN device

ip link add link enp0s31f6 name enp0s31f6.4000 type vlan id 4000
ip link set enp0s31f6.4000 mtu 1400
ip link set dev enp0s31f6.4000 up

Configure IP address 192.168.100.1 from the private subnet 192.168.100.0/24

ip addr add 192.168.100.1/24 brd 192.168.100.255 dev enp0s31f6.4000

Public subnet You need to create an additional routing table for the public subnet so you can configure another default gateway.

Example configuration for IP 213.239.252.50 from the public subnet 213.239.252.48/29, interface enp0s31f6.4000

echo "1 vswitch" >> /etc/iproute2/rt_tables
ip addr add 213.239.252.50/29 dev enp0s31f6.4000
ip rule add from 213.239.252.50 lookup vswitch
ip rule add to 213.239.252.50 lookup vswitch
ip route add default via 213.239.252.49 dev enp0s31f6.4000 table vswitch

Example Debian configuration

Interface enp0s31f6, VLAN 4000, private network

# /etc/network/interfaces
auto enp0s31f6.4000
iface enp0s31f6.4000 inet static
  address 192.168.100.1
  netmask 255.255.255.0
  vlan-raw-device enp0s31f6
  mtu 1400

Add IP 213.239.252.50 from public subnet 213.239.252.48/29 and IPv6 2001:db8:61:20e1::2 from public subnet 2001:db8:61:20e1::/64 on the host system.

Create an additional routing table.

echo "1 vswitch" >> /etc/iproute2/rt_tables
# /etc/network/interfaces
auto enp0s31f6.4000
iface enp0s31f6.4000 inet static
  address 192.168.100.1
  netmask 255.255.255.0
  vlan-raw-device enp0s31f6
  mtu 1400
  # ipv4 subnet
  up ip addr add 213.239.252.50/29 dev enp0s31f6.4000
  up ip rule add from 213.239.252.50 lookup vswitch
  up ip rule add to 213.239.252.50 lookup vswitch
  up ip route add default via 213.239.252.49 dev enp0s31f6.4000 table vswitch
  down ip addr del 213.239.252.50/29 dev enp0s31f6.4000
  down ip route del default via 213.239.252.49 dev enp0s31f6.4000 table vswitch
  down ip rule del to 213.239.252.50 lookup vswitch
  down ip rule del from 213.239.252.50 lookup vswitch
  # ipv6 subnet
  up ip -6 addr add 2001:db8:61:20e1::2/64 dev enp0s31f6.4000
  up ip -6 rule add from 2001:db8:61:20e1::2 lookup vswitch
  up ip -6 rule add to 2001:db8:61:20e1::2 lookup vswitch
  up ip -6 route add default via 2001:db8:61:20e1::1 dev enp0s31f6.4000 table vswitch
  down ip -6 addr del 2001:db8:61:20e1::2/125 dev enp0s31f6.4000
  down ip -6 route del default via 2001:db8:61:20e1::1 dev enp0s31f6.4000 table vswitch
  down ip -6 rule del to 2001:db8:61:20e1::2 lookup vswitch
  down ip -6 rule del from 2001:db8:61:20e1::2 lookup vswitch

Server configuration (Windows)

see VSwitch_für_Windows_Server/en

API

You can also configure vSwitches via the API [1].



© 2018. Hetzner Online GmbH. Alle Rechte vorbehalten.