Last active
February 5, 2020 03:04
-
-
Save dongho-jung/f709837ec9ee1dd827ae783c7d37f1ad to your computer and use it in GitHub Desktop.
bash snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find the ifindex values and each veth names | |
find /sys/class/net/veth* | xargs -I % echo 'cut -z -d"/" -f5 <<< % | tr "\n" " "; cat %/ifindex' | bash | |
# find the iflink of the container. it should be run in the container | |
cat /sys/class/net/eth0/iflink | |
# or if you want to traverse all the containers use this | |
for container in `docker ps -q`; do docker inspect --format='{{.Name}}' $container | tr '\n' ' '; docker exec -it $container cat /sys/class/net/eth0/iflink; done | |
# you can find which veth interface is mapped to which container |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment