You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 11, 2021. It is now read-only.
# --host-interface is the master interface, eth0, eth1 etc. The docker network create needs to correspond to that subnet for bridge mode
63
64
```
64
65
65
66
**3.** Create a network with Docker
66
67
67
68
**Note** the subnet needs to correspond to the master interface. In this example, the nic `eth1` is attached to a subnet `192.168.1.0/24`. The container needs to be on the same *broadast domain* as the default gateway. In this case it is a router with the address of `192.168.1.1`.
Run some containers, specify the network and verify they can ping one another
76
78
77
79
```
78
-
$ docker run --net=net1 -it --rm ubuntu
80
+
$ docker run --net=net1 -it --rm debian
81
+
```
82
+
83
+
Docker networks are now persistant after a reboot. The plugin does not currently support dealing with unknown networks. That is a priority next. To remove all of the network configs on a docker daemon restart you can simply delete the directory with: `rm /var/lib/docker/network/files/*`
84
+
85
+
86
+
### 802.1q Trunks with MacVlan
87
+
88
+
**Note** Containers using the **same** parent interface e.g. `eth1.20` can reach one another without an external router (intra-vlan). Containers on different VLANs/parent interfaces can not reach one another without an external router (inter-vlan).
89
+
90
+
### Vlan ID 20
91
+
92
+
```
93
+
# create a new subinterface tied to dot1q vlan 20
94
+
ip link add link eth1 name eth1.20 type vlan id 20
95
+
96
+
# enable the new sub-interface
97
+
ip link set eth1.20 up
98
+
99
+
# now add networks and hosts as you would normally by attaching to the master (sub)interface that is tagged
docker run --net=macvlan30 -it --name mcv_test3 --rm debian
119
+
docker run --net=macvlan30 -it --name mcv_test4 --rm debian
120
+
121
+
# mcv_test3 should be able to ping mcv_test4 now.
79
122
```
80
123
81
-
Docker networks are now persistant after a reboot. To remove all of the network configs on a docker daemon restart you can simply delete the directory with: `rm /var/lib/docker/network/files/*`
82
124
83
125
### Notes and General Macvlan Caveats
84
126
@@ -92,7 +134,7 @@ Docker networks are now persistant after a reboot. To remove all of the network
92
134
93
135
### Dev and issues
94
136
95
-
To run the plugin via Go for hacking simply run go with the `main.go` entry point and desired parameters. The same applies to the [gopher-net/ipvlan](https://github.com/gopher-net/ipvlan-docker-plugin) driver:
137
+
To run the plugin via Go for hacking simply run go with the `main.go`. The same applies to the [gopher-net/ipvlan](https://github.com/gopher-net/ipvlan-docker-plugin) driver:
// FlagMacvlanMode TODO: Values need to be bound to driver. Need to modify the Driver iface. Added brOpts if we want to pass that to Listen(string)
8
-
FlagMacvlanMode= cli.StringFlag{Name: "mode", Value: macvlanMode, Usage: "name of the macvlan mode [bridge|private|passthrough|vepa]. By default, bridge mode is implicit: --bridge-name=bridge"}
9
-
FlagGateway= cli.StringFlag{Name: "gateway", Value: gatewayIP, Usage: "IP of the default gateway. default: --bridge-ip=172.18.40.1/24"}
8
+
FlagMacvlanMode= cli.StringFlag{Name: "mode", Value: macvlanMode, Usage: "name of the macvlan mode [bridge|private|passthrough|vepa]. By default, bridge mode is implicit: --bridge-name=bridge"}
9
+
// FlagGateway = cli.StringFlag{Name: "gateway", Value: gatewayIP, Usage: "IP of the default gateway. default: --bridge-ip=172.18.40.1/24"}
10
10
FlagBridgeSubnet= cli.StringFlag{Name: "macvlan-subnet", Value: defaultSubnet, Usage: "subnet for the containers (currently IPv4 support)"}
11
-
FlagMacvlanEth= cli.StringFlag{Name: "host-interface", Value: macvlanEthIface, Usage: "the ethernet interface on the underlying OS that will be used as the parent interface that the container will use for external communications"}
11
+
12
+
// FlagMacvlanEth = cli.StringFlag{Name: "host-interface", Value: macvlanEthIface, Usage: "the ethernet interface on the underlying OS that will be used as the parent interface that the container will use for external communications"}
12
13
)
13
14
14
15
// Unexported variables
15
16
var (
16
17
// TODO: align with dnet-ctl for bridge properties.
17
-
macvlanMode="bridge"// currently only mode supported. Does anyone use the others?
18
-
macvlanEthIface="eth1"// parent interface to the macvlan iface
19
-
defaultSubnet="192.168.1.0/24"// magic default /24 for demo/testing
20
-
gatewayIP="192.168.1.1"// this is the address of an external route
21
-
cliMTU=1500// generally accepted default MTU
18
+
macvlanMode="bridge"// currently only mode supported. Does anyone use the others?
19
+
// macvlanEthIface = "eth1" // parent interface to the macvlan iface
20
+
defaultSubnet="192.168.1.0/24"// magic default /24 for demo/testing
21
+
// gatewayIP = "192.168.1.1" // this is the address of an external route
0 commit comments