infix
infix copied to clipboard
cli: improve 'show interfaces' to list container networks
Take this example:
admin@infix-00-00-00:/> show interfaces
INTERFACE PROTOCOL STATE DATA
---------------------------------------------------------------------
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
br0 bridge
│ ethernet UP 02:00:00:00:00:00
│ ipv4 169.254.1.3/16 (random)
│ ipv4 192.168.122.160/24 (dhcp)
├ e1 bridge FORWARDING
└ veth0b bridge FORWARDING
veth0a ethernet
veth0b ethernet UP 32:ed:2e:8b:17:9f
A simple setup with a bridge and a VETH pair. One end of the VETH pair is set as bridge port, but where's the other one?
Could it be in a container?
admin@infix-00-00-00:/> exit
admin@infix-00-00-00:~$ sudo container --net veth0a locate
system
There it was!
Proposed output:
admin@infix-00-00-00:/> show interfaces
INTERFACE PROTOCOL STATE DATA
---------------------------------------------------------------------
lo ethernet UP 00:00:00:00:00:00
ipv4 127.0.0.1/8 (static)
ipv6 ::1/128 (static)
br0 bridge
│ ethernet UP 02:00:00:00:00:00
│ ipv4 169.254.1.3/16 (random)
│ ipv4 192.168.122.160/24 (dhcp)
├ e1 bridge FORWARDING
└ veth0b bridge FORWARDING
veth0a ethernet container:system
veth0b ethernet UP 32:ed:2e:8b:17:9f
More information about a running container's network interfaces can be dumped using
sudo podman inspect system | jq -r '.[].NetworkSettings.Networks. Unfortunately that command does not list the name of the interfaces inside the container. For thatnsenteris needed, then inspecting all interfaces and comparing theirifnameto theirifalias.