I wrote this one to show me the VSID, name, MAC, and IP address for every interface on every VS:
printf "%5s%12s%19s%19s\n" "VSID" "Interface" "MAC Address" "IP Address/Prefix";for vsid in $(ip netns list 2>/dev/null | cut -d' ' -f3 | cut -d')' -f1;ls /proc/vrf/ 2>/dev/null | sort -n);do vsenv $vsid>/dev/null 2>&1 || vsx set $vsid>/dev/null 2>&1;for iface in $(ifconfig -a | egrep "^[^ ]" | awk '{print $1}' | egrep -v "^(lo[0-9]*$|usb)");do printf "%5s" $vsid;printf "%12s" $iface;printf "%19s" $(ip addr show $iface | grep ' link/ether ' | awk '{print $2}');printf "%19s" $(ifconfig $iface | grep ' inet ' | cut -d':' -f2 | cut -d' ' -f1);echo "";done;done
Works on SecurePlatform (really old versions), GAiA with 2.6 kernel (up through R80.30), and GAiA with 3.10 kernel (R80.40 and later).
Separately, I also quite like this for showing physical interface information:
printf "%9s%13s%10s%8s%6s\n" "Interface" "PCIe Addr" "PCI-ID" "Driver" "Link?";ifconfig -a | egrep "^[^ ]" | awk '{print $1}' | egrep -v "^(lo$|usb|bond[0-9\.]+|gre(tap)?[0-9]+|Mgmt\.[0-9]|eth[-0-9]+\.)" | xargs -n 1 -I @ sh -c 'printf "%9s" @;printf "%13s" $(ethtool -i @ | grep "bus" | cut -d" " -f2);printf "%10s" $(lspci -n | grep $(ethtool -i @ | grep "bus" | cut -d: -f3-4) | cut -d" " -f3);printf "%8s" $(ethtool -i @ | grep "driver" | cut -d" " -f2);printf "%6s" $(ethtool @ | grep "Link" | cut -d" " -f3);echo ""'
Example output:
[Expert@DallasSA:0]# printf "%5s%12s%19s%19s\n" "VSID" "Interface" "MAC Address" "IP Address/Prefix";for vsid in $(ip netns list 2>/dev/null | cut -d' ' -f3 | cut -d')' -f1;ls /proc/vrf/ 2>/dev/null | sort -n);do vsenv $vsid>/dev/null 2>&1 || vsx set $vsid>/dev/null 2>&1;for iface in $(ifconfig -a | egrep "^[^ ]" | awk '{print $1}' | egrep -v "^(lo[0-9]*$|usb)");do printf "%5s" $vsid;printf "%12s" $iface;printf "%19s" $(ip addr show $iface | grep ' link/ether ' | awk '{print $2}');printf "%19s" $(ifconfig $iface | grep ' inet ' | cut -d':' -f2 | cut -d' ' -f1);echo "";done;done
VSID Interface MAC Address IP Address/Prefix
0 eth0 00:11:22:33:44:55 10.0.1.253
0 eth1 00:11:22:33:44:56
0 eth2 00:11:22:33:44:57
0 eth3 00:11:22:33:44:58
0 eth4 00:11:22:33:44:59
0 eth5 00:11:22:33:44:5a
0 gretap0 00:00:00:00:00:00
0 gre0
[Expert@DallasSA:0]# printf "%9s%13s%10s%8s%6s\n" "Interface" "PCIe Addr" "PCI-ID" "Driver" "Link?";ifconfig -a | egrep "^[^ ]" | awk '{print $1}' | egrep -v "^(lo$|usb|bond[0-9\.]+|gre(tap)?[0-9]+|Mgmt\.[0-9]|eth[-0-9]+\.)" | xargs -n 1 -I @ sh -c 'printf "%9s" @;printf "%13s" $(ethtool -i @ | grep "bus" | cut -d" " -f2);printf "%10s" $(lspci -n | grep $(ethtool -i @ | grep "bus" | cut -d: -f3-4) | cut -d" " -f3);printf "%8s" $(ethtool -i @ | grep "driver" | cut -d" " -f2);printf "%6s" $(ethtool @ | grep "Link" | cut -d" " -f3);echo ""'
Interface PCIe Addr PCI-ID Driver Link?
eth0 0000:02:00.0 8086:150c e1000e yes
eth1 0000:03:00.0 8086:150c e1000e no
eth2 0000:04:00.0 8086:150c e1000e no
eth3 0000:05:00.0 8086:150c e1000e no
eth4 0000:06:00.0 8086:150c e1000e no
eth5 0000:07:00.0 8086:150c e1000e no
[Expert@DallasSA:0]#