Hetzner with external IPs

jessegeerts

New Member
Aug 17, 2016
7
0
1
25
Hi,

I want to give each VM its own external IP but I'm unable to get that working so I have for temporaily usage this:

Code:
### Hetzner Online GmbH - installimage
# Loopback device:
auto lo
iface lo inet loopback
iface lo inet6 loopback

# device: eth0
auto  eth0
iface eth0 inet static
  address   46.4.79.207
  netmask   255.255.255.224
  gateway   46.4.79.193
  # default route to access subnet
  up route add -net 46.4.79.192 netmask 255.255.255.224 gw 46.4.79.193 eth0

iface eth0 inet6 static
  address 2a01:4f8:140:6093::2
  netmask 64
  gateway fe80::1


auto vmbr2
iface vmbr2 inet static
    address 10.99.0.254
    netmask 255.255.255.0
    bridge_ports none
    bridge_stp off
    bridge_fd 0
    post-up echo 1 > /proc/sys/net/ipv4/ip_forward
    post-up iptables -t nat -A POSTROUTING -s '10.99.0.0/24' -o vmbr0 -j MASQUERADE
    post-down iptables -t nat -D POSTROUTING -s '10.99.0.0/24' -o vmbr0 -j MASQUERADE
    post-up iptables -t nat -A PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.99.0.2:22
    post-down iptables -t nat -D PREROUTING -i vmbr0 -p tcp --dport 1022 -j DNAT --to 10.99.0.2:22
And the provider is hetzner