ich betreue den Server eines Freundes welcher sich den aus der ServerBoerse von Hetzner bestellt hat. Der Server hat nun schon einige Jahre auf dem Buckel, aber es hackt an dem kompletten IP Zuweisung.
die IPs werden auf der Netzwerkkarte vai ip up eingebunden. *Externe IPs sind Teilanonymisiert.
Code: Select all
root ~ # nano /etc/network/interfaces
iface enp6s0 inet static
address xxx.xxx.xxx.xxx
netmask 255.255.255.224
gateway xxx.xxx.xxx.xxx
up route add -net xxx.xxx.xxx.xxx netmask 255.255.255.224 gw xxx.xxx.xxx.xxx dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
up ip addr add xxx.xxx.xxx.xxx/32 dev enp6s0
auto vmbr0
iface vmbr0 inet static
address 192.168.100.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 '192.168.100.0/24' -o enp6s0 -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -s '192.168.100.0/24' -o enp6s0 -j MASQUERADE
VM01 => 192.168.100.10
VM02 => 192.168.100.20
u.s.w.
auf dem Root Server wird eine IPTables basierendes Script ausgeführt welche die IP Adressen an das Jeweilige Interne Netz Routen sollte.
Code: Select all
#!/bin/bash
# POLICY
# ------------------------------------------------------------
iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD DROP
iptables -F
iptables -t nat -F
# REGELN :: LO
# ------------------------------------------------------------
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# REGELN :: DNAT + SNAT
# ------------------------------------------------------------
iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -j DNAT --to-destination 192.168.100.20
iptables -t nat -A POSTROUTING -s 192.168.100.20 -j SNAT --to-source xxx.xxx.xxx.xxx
iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -j DNAT --to-destination 192.168.100.30
iptables -t nat -A POSTROUTING -s 192.168.100.30 -j SNAT --to-source xxx.xxx.xxx.xxx
iptables -t nat -A PREROUTING -d 46.4.xxx.xxx -j DNAT --to-destination 192.168.100.50
iptables -t nat -A POSTROUTING -s 192.168.100.50 -j SNAT --to-source xxx.xxx.xxx.xxx
iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -j DNAT --to-destination 192.168.100.10
iptables -t nat -A POSTROUTING -s 192.168.100.10 -j SNAT --to-source xxx.xxx.xxx.xxx
# iptables -t nat -A PREROUTING -d xxx.xxx.xxx.xxx -j DNAT --to-destination 192.168.100.60
# iptables -t nat -A POSTROUTING -s 192.168.100.60 -j SNAT --to-source xxx.xxx.xxx.xxx
# iptables -t nat -A PREROUTING -d xxx.xxx.xxx.x -j DNAT --to-destination 192.168.100.Y
# iptables -t nat -A POSTROUTING -s 192.168.100.Y -j SNAT --to-source xxx.xxx.xxx.x
# REGELN :: NET - LOKAL - NET
# ------------------------------------------------------------
iptables -A INPUT -i enp6s0 -p tcp --dport 22 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp6s0 -p tcp --dport 80 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp6s0 -p tcp --dport 8006 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp6s0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp6s0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i enp6s0 -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o enp6s0 -p tcp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o enp6s0 -p udp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o enp6s0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
# REGELN :: VM - LOKAL - VM
# ------------------------------------------------------------
iptables -A INPUT -i vmbr0 -p tcp --dport 22 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i vmbr0 -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i vmbr0 -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -i vmbr0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o vmbr0 -p tcp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o vmbr0 -p udp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o vmbr0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
# REGELN :: NET - VM - NET
# ------------------------------------------------------------
iptables -A FORWARD -i enp6s0 -o vmbr0 -p tcp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i enp6s0 -o vmbr0 -p udp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i enp6s0 -o vmbr0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i vmbr0 -o enp6s0 -p tcp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i vmbr0 -o enp6s0 -p udp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i vmbr0 -o enp6s0 -p icmp -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
# END-REGELN
# ------------------------------------------------------------
iptables -A INPUT -i enp6s0 -j REJECT
iptables -A INPUT -i vmbr0 -j REJECT
iptables -A OUTPUT -o enp6s0 -j REJECT
iptables -A OUTPUT -o vmbr0 -j REJECT
iptables -A FORWARD -i enp6s0 -o vmbr0 -j REJECT
iptables -A FORWARD -i vmbr0 -o enp6s0 -j REJECTdas IPTables Script stammt nicht von mir dies ist noch von einem weiteren Administrator.
die VMs 2x Linux, 2x Windows haben alle das Selbe problem.
Das Hostsystem basiert auf Debian 10, Aktuelle Updates eingespielt in verbindung mit Proxmox. ebenfalls ist DNSMasQ installiert. Die VMs haben als DNS Server den Root eingetragen bekommen und als 2. DNS den Server 1.1.1.1, Gateway steht ebenfalls bei der Internen IP des Roots (192.168.100.254)
ich hoffe das mir hier jemand helfen kann denn das Routing Problem belastet auch die VMs wenn diese eine Verbindung zu anderen Servern aufbauen wollen um Versionen zu Prüfen.