Howdy, Stranger!

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


Proxmox LXC VMs -- Bind to own interface / Way to track network usage per VM
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.

Proxmox LXC VMs -- Bind to own interface / Way to track network usage per VM

MasonRMasonR Community Contributor

If anyone could help me out with this one and do me a solid, that'd be much appreciated -- or at least point me in the right direction.

Looking to set up a new node and load it up with many LXC containers. Each container will have its own dedicated IPv4 address. I've seen how you can limit the bandwidth that the container is allowed (e.g. 100 Mbps max), but not any built-in ways to limit traffic usage in a given month (e.g. 1TB/mo) within Proxmox.

Ideally, there'd exist some tool/script that would allow me to track each VM's network usage and shutdown the instance if a certain threshold was breached. But even a manual check every day or so is fine if I can somehow pull stats of usage per VM.

vnstat seems to be the way to go to manually check the network usage. The only issue is that it doesn't separate the usage per IP address since they are all bridged through the main Linux Network Bridge, so I can see the cumulative usage but with no granularity. Maybe I'm setting up the bridges wrong or need to do something slightly different in the config?

Has anyone run into/overcome this? Looking for free solutions that don't rely on a WHMCS/any other mgmt software backend. Using Proxmox 5.1 if that matters.

Thanks in advance!

Comments

  • WSSWSS Member
    edited January 2018

    tc and flag the subs? If it uses one virtual interface for all of the bridges, then that's kind of a design problem..

    Thanked by 1MasonR
  • I've only seen this done in WHMCS modules

    Thanked by 1MasonR
  • MasonRMasonR Community Contributor

    @WSS said:
    tc and flag the subs? If it uses one virtual interface for all of the bridges, then that's kind of a design problem..

    I'll have to look around for some tuts on how to do this and see if it's applicable. But yeah, I'm not sure of the specifics on how Proxmox handles the routing based on IP/bridge/virt interface, but I mean I can't be the first person to want to do this.

    @doughmanes said:
    I've only seen this done in WHMCS modules

    That's what I'm afraid of :/

    @Jack said: iptables per IP

    Hmm. Yeah, that might be an option. Found this blog post outlining some of the process. I'll probably start there and see where I get.

  • MasonRMasonR Community Contributor

    For what it's worth should anyone stumble upon this later on, I've installed ntopng community edition on my Proxmox host and it seems to do the job very nicely. Has a slick web interface and traffic can be easily broken down by IP address. May add some unnecessary overhead to the host, but I'm willing to sacrifice it if it means that I can track bandwidth usage per IP address / VM.

    Here's a little sample of one of the graphs for a specific VM's IP address -

    Thanked by 4WSS Aidan vimalware Falzo
  • If you're only looking for IPv4 details, try ipac-ng. I had to make a few (minor) tweaks to get it to compile for my (current) Debian 64 bit setup but once that was done, it has been fine and works like a charm. My personal use case is bandwidth accounting by protocol/app rather than by IP/VM but you should be able to customize the rules easily enough to track things by IP. Since it's essentially a wrapper around some iptables stuff, it is easily scriptable and you can cronify things as you need as well for alerts etc.

    One of my pet peeves with it has been getting it to support IPv6 but I've not gotten around to recompiling stuff with ip6tables hooks and so it will remain one of those hopefully elephants-can-fly type of projects... :-)

    Hope this helps.

    Thanked by 1MasonR
Sign In or Register to comment.