0

I happen to find out that the network component created by command docker network create <name> can be connected by more than 2 containers. And I ran cmd docker network inspect <name> and noticed that the network component was based on 'bridge' driver. Mostly, a bridge has only two port, and working on the Data Link Layer(Layer 2), but the docker bridge network has configuration about gateway IP, subnet IP, and act like a router... why is that?

$ docker network inspect test_net
[
    {
        // ... more ...
        "Driver": "bridge",
        "IPAM": {
            "Driver": "default",
            "Options": {},
            "Config": [
                {
                    "Subnet": "172.19.0.0/16",
                    "Gateway": "172.19.0.1"
                }
            ]
        },
        // ... more ...
        "Containers": {
            "179f58df1703141de16910b3da6b5e20d3dacf84ac8ba54dcd056b22fdbb5131": {
                // ... more ...
            },
            "54eef07a7cd456b0e7eb66cb0c382e7209905cffd813d2203316ab676d3850ff": {
                // ... more ...
            },
            "d2019820a6ef143c64d07b40d77e9e6d891834189de12dc57b02d202c5142c32": {
                // ... more ...            }
        }
    }
]

I'm learn docker for the moment, and trying to build a small network with docker container for testing purpose. I need a network component that acts like a physical switch device, with three ubuntu containers connected to it, so that I can inspect the network traffic with tools like tcpdump. But I didn't find any network component running with 'switch' type.

Loong
  • 1
  • 1
  • Docker might not be the right tool for a serious network simulation. Its supported set of topologies is pretty limited, and it doesn't have concepts like "switch" or connections between networks other than via the host system. – David Maze Jan 31 '23 at 02:38
  • "_Mostly, a bridge has only two port_" No, bridges can have any number of ports. Switches are bridges (switch was originally a marketing term for a high-port count bridge). – Ron Maupin Jan 31 '23 at 02:45
  • @DavidMaze Thank you for saving me from going to a wrong direction! – Loong Jan 31 '23 at 02:52
  • @RonMaupin Impressive! Thank you! – Loong Jan 31 '23 at 02:53

0 Answers0