How do you configure multiple IPs in Proxmox ?

Thanks to @VirMach and his virtbot deals, I ended up with a VM with 6 IPs available.
So what is the best way to configure these to integrate in to Proxmox.
It would be great if you could give examples of /etc/network/interfaces allocation and how you set Proxmox, I assume using a virtual bridge?
I don't need NAT (already got that configured for the main ip). So each extra IP woulld be dedicated to just a single LXC / VM.
Hopefully these details will also prove handy for others.
Thanks.

Thanked by (1)VirMach

Comments

  • You choose one of the IPs for the host and configure the gateway, like

    auto vmbr0
    iface vmbr0 inet static
            address <main ip>/24
            gateway <gateway ip>
    

    Then the other IPs (assuming on the same subnet) are configured in the respective container/VM.

    Thanked by (1)msatt
  • edited December 5

    If the hypervisor doesn't filter out extra MACs, you can just slap network interfaces into a bridge and bob's your uncle.

    Otherwise you need a routed setup,

    or if you're feeling a bit adventurous configure them on the host then DNAT them into the VM/CTs.

    Thanked by (2)msatt yoursunny
  • AlwaysSkintAlwaysSkint OGSenpai
    edited December 5

    Here's my interfaces snippet, to get you started. Then just add one of your other IPs to a newly created VM, using the same gateway as the host.
    Your primary network device name (enp2s0) may be different.

    auto enp2s0
    iface enp2s0 inet manual
    dns-nameservers 8.8.8.8
    dns-search xxxx.net

    auto vmbr0
    iface vmbr0 inet static
    address 204.xxx.xxxx.218/29
    gateway 204.xxx.xxx.217
    bridge-ports enp2s0
    bridge-stp off
    bridge-fd 0

    Notes: other methods are possible. I run CSF as the firewall on the host, rather than the Proxmox one. None of my multi-IP Virmach VPS have sufficient RAM for Proxmox, so the above is on a dedicated server.
    [Edit] Hmm, tempted to at least try on a 2GB RAM VPS, just for kicks.

    Thanked by (3)msatt ariq01 wankel

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • Thanked by (1)msatt

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • edited December 5

    just enter ip and gateway by hand :D to the vps

    Thanked by (1)msatt
  • @tridinebandim said:
    just enter ip and gateway by hand :D to the vps

    Oh ffs - that was so simple !!!
    I did mess around with bridges etc etc and was really struggling. Why is it that engineers never take the most obvious route ?

  • @msatt said: that was so simple

    Seeing as you're sorted, I'll leave my already configured server alone. ;)

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • @AlwaysSkint said:

    @msatt said: that was so simple

    Seeing as you're sorted, I'll leave my already configured server alone. ;)

    Oh go on, you know your really want to bugger things up - think of the learning experience ;)
    Mine is already part of a cluster and I didn't fancy all of hassle of removing it, rebuilding and then somehow joining to the cluster again.

    Thanked by (2)AlwaysSkint ariq01
  • AlwaysSkintAlwaysSkint OGSenpai
    edited December 6

    @msatt
    Took a new @Virmach VPS with only 1.5GB RAM and gave it 3GB swap. Installed Debian 12, manually partitioning the storage. Disabled pve clustering stuff (to save resources).
    Needed the previously quoted interfaces example, to create a bridge - CT (container) required a bridge in the GUI.
    Installed Turnkey lighttpd-php-fastcgi using only 512MB RAM & 512MB swap. I used the additional IP address, as supplied.

    Works great! :D

    Thanked by (2)msatt ariq01

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • AuroraZeroAuroraZero ModeratorHosting Provider

    @tetech said:
    You choose one of the IPs for the host and configure the gateway, like

    auto vmbr0
    iface vmbr0 inet static
            address <main ip>/24
            gateway <gateway ip>
    

    Then the other IPs (assuming on the same subnet) are configured in the respective container/VM.

    Precisely no need to add to the main interface.

    Free Hosting at YetiNode | Cryptid Security | URL Shortener | LaunchVPS | ExtraVM | Host-C | In the Node, or Out of the Loop?

  • @AuroraZero said: ..are configured in the respective container.

    When created in the GUI a bridge is required, perhaps not the case if using CLI (I don't know).

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • AuroraZeroAuroraZero ModeratorHosting Provider
    edited December 7

    @AlwaysSkint said:

    @AuroraZero said: ..are configured in the respective container.

    When created in the GUI a bridge is required, perhaps not the case if using CLI (I don't know).

    Just did it and didn't need to, IP/29 on bridge assigned IP to kvm container. Works fine.

    If it is setup correctly the bridge is the interface not eth0 or whatever it is named for you.

    Thanked by (1)AlwaysSkint

    Free Hosting at YetiNode | Cryptid Security | URL Shortener | LaunchVPS | ExtraVM | Host-C | In the Node, or Out of the Loop?

  • Weird. When I find time I'll fire up the testbed and try again. :/

    It wisnae me! A big boy done it and ran away.
    NVMe2G for life! until death (the end is nigh)

  • AuroraZeroAuroraZero ModeratorHosting Provider

    As long as you add the correct subnet mask eg. /29 plus the netmask, gateway to the interface you should be able to assign any IP inside it to a vm.

    Example:
    IPADDR="192.158.0.1/29"
    NETMASK="255.255.255.0"
    Gateway="192.168.0.1"

    Thanked by (1)ariq01

    Free Hosting at YetiNode | Cryptid Security | URL Shortener | LaunchVPS | ExtraVM | Host-C | In the Node, or Out of the Loop?

  • Create bridge and set your vm network using the bridge.
    Add ip to your vm as you wish

Sign In or Register to comment.