Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Hetzner server with Proxmox and 1 IP number
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Hetzner server with Proxmox and 1 IP number

wilbowilbo Member

I'm trying to configure a Hetzner server with Proxmox and 1 IP. I want to make several virtual machines with the 1 IP number assigned to the machine. Does anyone have a working /etc/network/interfaces and VM setup they care to share? I have been working on this for a week in my spare time with no luck. All the configurations I try don't seem to work for me.
I want a windows desktop via RDP, a linux desktop via ssh and a linux server via ssh.

Comments

  • did you want ipv4 nat with/without port forwarding? ipv6 only? or internal networking?

  • Whatever will get all 3 VMs working and accessible from the internet with the 1 IP number the server came with. I know I can order more IPs, but I wanna learn how to do it with just one ip.

  • again, question is what you exactly want. If you want the vms to have access to the internet , that can be done via ipv4 nat or ipv6. if you want to access the vms that can be done via ipv6, ipv4 nat with some port forwarding or internal network+vpn into the host.

    youll have to decide what you actually want.

  • Ipv4 nat and port forwarding please.

  • cjdcjd Member

    You need to use NAT on the host to forward packets from external_ip:port to internal_ip:port.

    It's been a while since I did this but on OVH I followed this guide http://help.ovh.co.uk/Proxmox (see 'create a vm nat').

  • @cjd said:
    You need to use NAT on the host to forward packets from external_ip:port to internal_ip:port.

    It's been a while since I did this but on OVH I followed this guide http://help.ovh.co.uk/Proxmox (see 'create a vm nat').

    Tried that, didn't work for me.

  • This looks fine on first glance: https://raymii.org/s/tutorials/Proxmox_VE_One_Public_IP.html

    I dont set this up often enough to know it by heart and I cant test it atm.

  • @MagicalTrain said:
    This looks fine on first glance: https://raymii.org/s/tutorials/Proxmox_VE_One_Public_IP.html

    I dont set this up often enough to know it by heart and I cant test it atm.

    I've tried this exact tutorial a few times with no luck.

  • Hi man, i set one of boxes with pfsense and 2 ip's. Didn't try to make working with only one IP, but I saw it can be done. But to write tutorial for that I need few hours and not sure that even then you will get to the point. But i used some French and English tutorials and here you can check them: https://paste.lugons.org/?92e1b22334cea9db#JHUqf2EoOhkxm/hF90hcwK79c3gidToeQs2XLFzYqxo=

    Thanked by 1wilbo
  • Ok, so since I had to set up my proxmox at some point anyway, I did it just now.

    This is the relevant part in my interfaces config:

    auto vmbr2
    iface vmbr2 inet static
        address 10.0.0.1
        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 echo 1 > /proc/sys/net/ipv4/conf/vmbr2/proxy_arp
        post-up iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o vmbr0 -j MASQUERADE
    

    Important to remember: do not enable the firewall in the vmbr2 network interface. Tripped me up for a good half hour. If you want to enable ipv6 as well in the vm, I put that into a second network interface, so I can properly firewall that interface.

    Do remember to restart the networking at least when you change the firewall setting of the vm. (of the vm)

    Still not entirely sure why enabling the firewall on the vmbr2 interface will completely break masquerading. (even if I whitelist the 10.0.0.0 range) But it works now, and firewall on nat isnt needed anyway, just a tad annoying to have to put my ipv6 into a separate interface.

    Thanked by 1wilbo
  • @raymii's tutorial is definitely fine and covers it.

    of course you need to give your VMs an internal IP out of the range you choose for vmbr2 and use the IP of that bridge as gateway.

    also to be able to connect to the guests via ssh or rdp you need to add port forwardings to the IPs given to those VMs.

    so to help you any further you need to be more precise what exactly is not working as expected ;-)

  • Thank you very much. I just woke up and found my box down and am waiting for a boot. The rescue system will not work. I'll bet I have 20 hours invested in this little endeavor to use 1 IP.

  • @wilbo said:

    you need to reboot or issue a reset after enabling the rescue system... usually an automatic hard reset should do the job.

    also you need to be more specific on what exactly doesn't work ;-)

    on a sidenote: if you want someone to have a look at it, you can create an additional administrative login within the hetzner robot to not share your own credentials...

    Thanked by 1wilbo
  • It works!!!
    Thank you everyone!

    I wanted to post my solution cuz I hate when I Google these questions and people don't say how they did it. MagicTrain did all the hard work for me.

    Here is how I did it. My server has eth0 instead of vmbr0.
    I added the following to the bottom of my /etc/network/interfaces . I left everything the same and just added this to the bottom.

    auto vmbr2 iface vmbr2 inet static address 10.0.0.1 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 echo 1 > /proc/sys/net/ipv4/conf/vmbr2/proxy_arp post-up iptables -t nat -A POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE post-down iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 13389 -j DNAT --to 10.0.0.101:3389 post-down iptables -t nat -D PREROUTING -i eth0 -p tcp --dport 13389 -j DNAT --to 10.0.0.101:3389 post-up iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 12222 -j DNAT --to 10.0.0.102:22 post-down iptables -t nat -D PREROUTING -i eth0 -p tcp --dport 12222 -j DNAT --to 10.0.0.102:22

    When I made the VMs I used any number in the 10.0.0.0 range. In my case it was 10.0.0.101 for my Windows desktop server. I used "bridged mode" and used the vmbr2 bridge when creating the VM in the Proxmox interface network.

    After the VM was created I went into the windows machine via the console on Proxmox and used 10.0.0.101 for the ip number, 255.255.255.0 for the netmask and the server IP number for the gateway ( the ip number you use for proxmox, minus the :8006 ).
    Then I went into Windows settings and enabled remote connections.
    I then used RDP to connect to the desktop. I used the server IP number (the same as Proxmox, minus the :8006) and added :13389 after the IP number.

    I then made a container using a Debian template I downloaded with the Proxmox interface. I used 10.0.0.102/24 for the IP number and the server IP number for the gateway. I now have access to the Debian server vi ssh using the server ip number on port 12222.

    Thanked by 2MagicalTrain neotron
  • Happy to hear its working, though im not entirely sure what the solution in the end was for you. Anyway, it works now, thats the main part.

  • so at which point does your solution differs to @raymii's tutorial?

    of course you should have read it till the end to find out, that you would need to forward ports accordingly to the IPs given to the VM guests, depending on which application you would want to use...

    but I already told you so :-P ;-)

Sign In or Register to comment.