Coder Social home page Coder Social logo

platypuschan / find_veth_docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cslev/find_veth_docker

1.0 0.0 0.0 26 KB

Simple script to find out which veth interface on the host corresponds to the eth0 interface of a container

License: GNU General Public License v3.0

Shell 100.00%

find_veth_docker's Introduction

find_veth_docker

Simple script to find out which veth interface on the host corresponds to the eth0 interface of a container

Requirements

After using this script in countless environments, I had to come to the conclusion that the containers in question have to have iproute2 utility installed. The scripts uses the command ip in the containers to gather the necessary information. If your container does not have it, install it. Don't forget that most containers are optimized for size, i.e., before installing a package you have to update the repository. In case of Debian/Ubuntu-based container images, do the following.

sudo docker exec -it <CONTAINER_NAME> apt-get update
sudo docker exec -it <CONTAINER_NAME> apt-get install iproute2

For Redhat/etc-based containers, please adopt the above-mentioned commands.

Usage

This script finds out which vethXXXX is connected to what container!
Example: sudo ./find_veth_docker.sh -n <CONTAINER_NAME> -i <INTEFACE_IN_CONTAINER>
		-n <CONTAINER_NAME>: set here the name of the container (Default: No name specified, printing all containers' data).
		-i <INTERFACE_IN_CONTAINER>: set here the name of the interace in the container (Default: eth0).

Example

sudo ./find_veth_docker.sh -n google
VETH@HOST	CONTAINER
veth003b9c4	google

Using output for scripts

You might want to change some setting for a particular container's vethXXXX device. Let's take an example for ethtool that disables checksumming on the interfaces.

sudo ethtool -K $(./find_veth_docker.sh -n google |grep -v @|awk '{print $1}') tx off rx off

find_veth_docker's People

Contributors

cslev avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.