[SOLVED] Hetzner additional address

scotobaza

Member
Mar 23, 2022
4
0
6
Until recently, I worked with Proxmox VMs on hetzner dedicated server via masquerading, but now I needed direct access to the VM and I ordered an additional ip. And can't set it up

additional ip is 148.*.*.13/27

Here is my config with what I have already tried

Code:
***Generated automatically***

source /etc/network/interfaces.d/*

auto lo
iface lo inet loopback

iface lo inet6 loopback

auto enp4s0
iface enp4s0 inet static
        address 148.*.*.4/27
        gateway 148.*.*.1
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward                             #two strings from guides
        post-up echo 1 > /proc/sys/net/ipv4/conf/enp4s0/proxy_arp       #
        up route add -net 148.*.*.0 netmask 255.255.255.224 gw 148.*.*.1 dev enp4s0
# route 148.*.*.0/27 via 148.*.*.1

iface eth0 inet manual

***Generated automatically***

auto vmbr0
iface vmbr0 inet static
        address 192.*.*.1/24
        bridge-ports none
        bridge-stp off
        bridge-fd 0

auto vmbr1
iface vmbr1 inet static
        address 148.*.*.4/27
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        hwaddress 00:50:56:00:A1:49

        post-up   echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up   iptables -t nat -A POSTROUTING -s '192.*.*.0/24' -o enp4s0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.*.*.0/24' -o enp4s0 -j MASQUERADE
        ***and a lot of nat rules***

used data from these sources:
1. https://community.hetzner.com/tutor...ure-proxmox_ve#step-2---network-configuration
2. https://pve.proxmox.com/wiki/Network_Configuration
 
Last edited:
Hello,

both your vmbr1 and your Interface enp4s0 seem to share the same IP-Adress, is that intended?

It also depends on the application, but in order to 'access a VM from the outside' it is not always neccessary to get another external IP-Address. In many cases you can just use port forwarding.

Kind regards,
Benedikt
 
both your vmbr1 and your Interface enp4s0 seem to share the same IP-Adress, is that intended?
this settings from https://community.hetzner.com/tutor...ox_ve#network-configuration-hostsystem-routed
I also tried to use an additional address as IP address for vmbr1, but it did not help. Perhaps the problem is that the primary and secondary addresses are on the same subnet? Cant understand

It also depends on the application, but in order to 'access a VM from the outside' it is not always neccessary to get another external IP-Address. In many cases you can just use port forwarding.
I worked like this before, but now there is a need for a separate VM with its own IP
 
I don't know much about hetzner servers, but I guess you could do it similar to the "# for single IPs" in the example config.

Configure your VM with the static ip 148.*.*.13/27 and gateway 148.*.*.4, put the VM on vmbr1 and configure your host interfaces file like this:

Code:
auto vmbr1
iface vmbr1 inet static
        address 148.*.*.4/27
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        hwaddress 00:50:56:00:A1:49
        up ip route add 148.*.*.13/32 dev vmbr1
        down ip route del 148.*.*.13/32 dev vmbr1

Inbound packets to your external interface with target-ip 148.*.*.13 will then get routed to vmbr1, where your VM sits.
In the other direction, if your VM has the Host IP as its gateway, it should be able to answer on the same way.
 
just to clarify. Did you ordered additional IPs on vSwitch? If so, than you just need to configure new bridge without IPs like vmbr1 with VLAN of you vSwitch ( enp4s0.4??? ) and put your VM to vmbr1 with gateway specified by hetzner.
 
I don't know much about hetzner servers, but I guess you could do it similar to the "# for single IPs" in the example config.

Configure your VM with the static ip 148.*.*.13/27 and gateway 148.*.*.4, put the VM on vmbr1 and configure your host interfaces file like this:

Code:
auto vmbr1
iface vmbr1 inet static
        address 148.*.*.4/27
        bridge-ports none
        bridge-stp off
        bridge-fd 0
        hwaddress 00:50:56:00:A1:49
        up ip route add 148.*.*.13/32 dev vmbr1
        down ip route del 148.*.*.13/32 dev vmbr1

Inbound packets to your external interface with target-ip 148.*.*.13 will then get routed to vmbr1, where your VM sits.
In the other direction, if your VM has the Host IP as its gateway, it should be able to answer on the same way.
I tried to do as you said, it is logical and should work, but it didnt

just to clarify. Did you ordered additional IPs on vSwitch? If so, than you just need to configure new bridge without IPs like vmbr1 with VLAN of you vSwitch ( enp4s0.4??? ) and put your VM to vmbr1 with gateway specified by hetzner.
No, i ordered it in server settings, in IPs section, but i will try it anyway, I just have no ideas
 
Last edited:
I had to completely reconfigure all network settings following the example of this link in order for the additional IP address to start working. Apparently, vmbr0 is important for Proxmox to configure additional IPs, since I tried these settings in vmbr1 and they did not work.

Now it works
 
Last edited:
I had to completely reconfigure all network settings following the example of this link in order for the additional IP address to start working. Apparently, vmbr0 is important for Proxmox to configure additional IPs, since I tried these settings in vmbr1 and they did not work.

Now it works

hello

i'm having the same problem.

Could you show the example of your interfaces?

thanks
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!