Show IP with PCT list command

MihaG

Active Member
Jun 16, 2019
23
0
41
48
Hello,

is there any ways to show CT(LXC) internal IP with command PCT list?

Regards,
 
hi,

no (containers can have multiple network interfaces, so it'd be troublesome to show multiple IPs without breaking output)

however, but something like this can work: grep -R 'net[0-9]*' /etc/pve/lxc/
 
In any case: with VM we have the ability to extract IP from agent and show it in interface
Why not consider to do the same with a script or an agent like in the container?

Anyway tx, Diaolin
 
See proxmox more as a system that brings all the good things together, instead of a full from one hand/company made hypervisor, like esxi.

So on one side that's something that needs to get implemented in lxc first.
On the other side, since proxmox does the gui, it's actually possible to request this as future feature i think.

It nervs me tbh too, that I can't see in the gui the ip of my lxc containers. I have everything dhcp controlled.

So if it's possible to implement, it would be amazing. Doesn't needs to be any complex guest agent or something. Maybe a simple bash script would do it, to just grab the ip's and output it into the gui :D
On the other side, maybe a super simple systemd service can do it too, since many parts of lxc containers are accessible from the host itself. Probably if i have some time, i check myself what's the best way to do this.

Cheers
 
See proxmox more as a system that brings all the good things together, instead of a full from one hand/company made hypervisor, like esxi.

So on one side that's something that needs to get implemented in lxc first.
On the other side, since proxmox does the gui, it's actually possible to request this as future feature i think.

It nervs me tbh too, that I can't see in the gui the ip of my lxc containers. I have everything dhcp controlled.

So if it's possible to implement, it would be amazing. Doesn't needs to be any complex guest agent or something. Maybe a simple bash script would do it, to just grab the ip's and output it into the gui :D
On the other side, maybe a super simple systemd service can do it too, since many parts of lxc containers are accessible from the host itself. Probably if i have some time, i check myself what's the best way to do this.

Cheers
My college is doing it and i pass the perl script to the developers...
I think thatp pct exec is sufficient

Diaolin
 
  • Like
Reactions: Ramalama
The script

pct_ethernet_show.pl

#!/usr/bin/perl ############################################################################## # # Autori: Marco Colombo (marco@openit.it) # Valentina Portolan (valentina@openit.it) # Giuliano Natali Diaolin (diaolin@openit.it) # Copyright: Open It S.r.l. # Via Dante 300 # 38057 Pergine Valsugana (TN) ITALY # Tel: +39 0461 504800 Fax: +39 0461 538443 # # release $Name: $ # revision $Revision: 1.27 $ ########################################################################## # usage: $0 ID ########################################################################## package main; use Socket; # controlla sintassi if ($#ARGV != 0) { print "ERROR USAGE: $0 <ID>\n"; exit(0); $ID = $ARGV[0]; @CONTENT = `pct exec $ID ip addr`; $NUMERO=""; $INTERFACCIA=""; $INET=""; $INET6=""; foreach $row (@CONTENT) { if ($row =~ /^\d\:/) { $row =~ /^(\d+)\:/; $NUMERO =$1; $row =~ /^\d+\:\s(.+)\:/; $INTERFACCIA= $1; # print "NUMERO=$NUMERO INTERFACCIA=$INTERFACCIA\n"; $INET=""; $INET6=""; } elsif ($row =~ /^\s+inet\s/) { $row =~ /inet\s(\S+)\s/; $INET=$1; # print "INET=$INET\n"; } elsif ($row =~ /^\s+inet6\s/) { $row =~ /inet6\s(\S+)\s/; $INET6=$1; # print "INET6=$INET6\n"; print "$NUMERO $INTERFACCIA $INET $INET6\n"; } } exit(0);

Use from proxmox directly
Diaolin
 
  • Like
Reactions: Ramalama

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!