Proxmox IP Konfiguration bei Hetzner mit Zusatz IP's

OS Installation, Konfiguration etc.
Post Reply
User avatar
h3rb3rn
Administrator
Posts: 189
Joined: Mon 9. Feb 2015, 23:29

Proxmox IP Konfiguration bei Hetzner mit Zusatz IP's

Post by h3rb3rn »

aktualisierte Fassung vom 01.11.2018

Das Hetzner Wiki https://wiki.hetzner.de/index.php/KVM_m ... e_easy_way



Ihr müsst eure IP Adressen statt der meinen verwenden. Die im Code verwendeten IP's sind nur zum Veranschaulichen.

IP Konfiguration der Host Maschine

Code: Select all

### Hetzner Online GmbH installimage

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback
#iface lo inet6 loopback
iface enp4s0 inet manual

auto vmbr0
iface vmbr0 inet static
  address 216.101.210.67
  netmask 255.255.255.224
  gateway 216.101.210.65
  bridge_ports enp4s0
  bridge_stp off
  bridge_fd 0
  bridge_maxwait 0
  # route 216.101.210.64/27 via 216.101.210.65
  dns-nameservers 213.133.98.98 213.133.99.99
  up route add -net 216.101.210.64 netmask 255.255.255.224 gw 216.101.210.65 dev vmbr0
  up route add -host 217.112.123.240 dev vmbr0
  up route add -host 217.112.123.241 dev vmbr0
  up route add -host 217.112.123.242 dev vmbr0
  up route add -host 217.112.123.243 dev vmbr0
  up route add -host 217.112.123.244 dev vmbr0
  up route add -host 217.112.123.245 dev vmbr0
  up route add -host 217.112.123.246 dev vmbr0
  up route add -host 217.112.123.247 dev vmbr0

# fuer ein Subnet
#auto vmbr1
#iface vmbr1 inet static
#  address 217.112.123.240
#  netmask 255.255.255.248
#  bridge_ports none
#  bridge_stp off
#  bridge_fd 0

#iface enp4s0 inet6 static
#  address 2a01:3d2:182:1442::2
#  netmask 64
#  gateway fe80::1
Beim Host muss noch IP Forwarding aktiviert werden

Code: Select all

sudo sysctl -w net.ipv4.ip_forward=1  


IP Konfiguration des Gast Systems

Variante 1: ifupdown via /etc/network/interfaces

Code: Select all

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

auto ens18
iface ens18 inet static
  address 217.112.123.240
  netmask 255.255.255.224
  pointopoint 216.101.210.67
  gateway 216.101.210.67
  dns-nameservers 213.133.98.98 213.133.99.99


Variante 2: Netplan via /etc/netplan/01-network-manager-all.yaml ab Ubuntu 17.10

Quelle: https://wiki.ubuntuusers.de/Netplan/

Code: Select all

sudo vim /etc/netplan/01-network-manager-all.yaml
Statt "pointtopoint" (PPP) muss "routes" in Netplan verwendet werden.

Quelle: https://unix.stackexchange.com/question ... ed-example

Code: Select all

# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
  version: 2
  renderer: networkd
  ethernets:
    ens18:
      addresses: ["217.112.123.240/29"]
      dhcp4: no
          gateway4: 216.101.210.67
      dhcp6: no
      nameservers:
          addresses: ["213.133.98.98","213.133.99.99"]
      routes:
        - to: 0.0.0.0/0
          via: 216.101.210.67
          on-link: true
Änderung übernehmen

Code: Select all

 netplan apply

Die IP Adresse der Gast Systeme von 217.112.123.240 bis 217.112.123.247 fortlaufend auf die Virtuellen Maschinen verteilen.

Ihr solltet auch daran denken den PTR für die Zusatz IP's zu setzen sofern Ihr die VMs als Webserver und/oder Mailserver einsetzen wollt.
Post Reply