Per individuare l'interfaccia
Nel mio caso ottenere valore dal contenitore era come (check eth0
a):
$ docker exec -it my-container cat /sys/class/net/eth1/iflink
123
E poi:
$ ip ad | grep 123
123: [email protected]: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master docker_gwbridge state UP group default
Verificare con tcpdump -i vethd3234u4
Riferimento a mysteriou s iflink
da http://lxr.free-electrons.com/source/Documentation/ABI/testing/sysfs-class-net:
150 What: /sys/class/net/<iface>/iflink
151 Date: April 2005
152 KernelVersion: 2.6.12
153 Contact: [email protected]
154 Description:
155 Indicates the system-wide interface unique index identifier a
156 the interface is linked to. Format is decimal. This attribute is
157 used to resolve interfaces chaining, linking and stacking.
158 Physical interfaces have the same 'ifindex' and 'iflink' values.
Sembra come se fosse una questione aperta qui https://github.com/docker/docker/issues/14666 e ci sono alcune soluzioni alternative. Non sono bravo a fare networking e non capisco davvero quei rimedi, quindi ho deciso di filtrare solo per host quando uso tcpdump. Per me va bene. Forse funzionerà per te se usi anche tcpdump o se il tuo strumento ha filtri simili. –