-
-
Save ik5/6e383127ef12b5eb1281df3948d6458f to your computer and use it in GitHub Desktop.
Revisions
-
milosgajdos revised this gist
Dec 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import ( func main() { // CREATE MACVLAN HOST INTERFACE macVlanHost, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge", Dev: "macvlanHostIfc"}) if err != nil { log.Fatal(err) } @@ -29,7 +29,7 @@ func main() { } // CREATE MACVLAN DOCKER INTERFACE macVlanDocker, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge",Dev: "macvlanDckrIfc"}) if err != nil { log.Fatal(err) } -
milosgajdos revised this gist
Jul 29, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import ( func main() { // CREATE MACVLAN HOST INTERFACE macVlanHost, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanHostIfc"}) if err != nil { log.Fatal(err) } @@ -29,7 +29,7 @@ func main() { } // CREATE MACVLAN DOCKER INTERFACE macVlanDocker, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanDckrIfc"}) if err != nil { log.Fatal(err) } -
milosgajdos revised this gist
Jul 27, 2014 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -35,7 +35,6 @@ func main() { } // PASS MACVLAN INTERFACE TO A RUNNING DOCKER BY PID pid, err := tenus.DockerPidByName("mcvlandckr", "/var/run/docker.sock") if err != nil { log.Fatal(err) -
milosgajdos revised this gist
Jul 13, 2014 . 1 changed file with 8 additions and 10 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,16 @@ package main import ( "fmt" "log" "net" "github.com/milosgajdos83/tenus" ) func main() { // CREATE MACVLAN HOST INTERFACE macVlanHost, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanHost"}) if err != nil { log.Fatal(err) } @@ -30,21 +29,20 @@ func main() { } // CREATE MACVLAN DOCKER INTERFACE macVlanDocker, err := tenus.NewMacVlanLinkWithOptions("eth1", tenus.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanDckr"}) if err != nil { log.Fatal(err) } // PASS MACVLAN INTERFACE TO A RUNNING DOCKER BY PID // docker run -i -t --rm --privileged --name mcvlandckr ubuntu:14.04 /bin/bash pid, err := tenus.DockerPidByName("mcvlandckr", "/var/run/docker.sock") if err != nil { log.Fatal(err) } if err := macVlanDocker.SetLinkNetNsPid(pid); err != nil { log.Fatal(err) } // ALLOCATE AND SET IP FOR THE NEW DOCKER INTERFACE @@ -53,7 +51,7 @@ func main() { log.Fatal(err) } if err := macVlanDocker.SetLinkNetInNs(pid, macVlanDckrIp, macVlanDckrIpNet, nil); err != nil { log.Fatal(err) } } -
milosgajdos revised this gist
Jun 28, 2014 . No changes.There are no files selected for viewing
-
milosgajdos created this gist
Jun 27, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,59 @@ // +build amd64 package main import ( "fmt" "log" "net" "github.com/milosgajdos83/docknet" ) func main() { // CREATE MACVLAN HOST INTERFACE macVlanHost, err := docknet.NewMacVlanLinkWithOptions("eth1", docknet.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanHost"}) if err != nil { log.Fatal(err) } macVlanHostIp, macVlanHostIpNet, err := net.ParseCIDR("10.0.41.2/16") if err != nil { log.Fatal(err) } if err := macVlanHost.SetLinkIp(macVlanHostIp, macVlanHostIpNet); err != nil { fmt.Println(err) } if err = macVlanHost.SetLinkUp(); err != nil { fmt.Println(err) } // CREATE MACVLAN DOCKER INTERFACE macVlanDocker, err := docknet.NewMacVlanLinkWithOptions("eth1", docknet.MacVlanOptions{Mode: "bridge", MacVlanDev: "macvlanDckr"}) if err != nil { log.Fatal(err) } // PASS MACVLAN INTERFACE TO A RUNNING DOCKER BY PID // docker run -i -t --rm --privileged --name mcvlandckr ubuntu:14.04 /bin/bash // docker inspect --format='{{ .State.Pid }}' mcvlandckr pid, err := docknet.DockerPidByName("mcvlandckr") if err != nil { fmt.Println(err) } if err := macVlanDocker.SetLinkNsPid(pid); err != nil { fmt.Println(err) } // ALLOCATE AND SET IP FOR THE NEW DOCKER INTERFACE macVlanDckrIp, macVlanDckrIpNet, err := net.ParseCIDR("10.0.41.3/16") if err != nil { log.Fatal(err) } if err := macVlanDocker.SetNsNetwork(pid, macVlanDckrIp, macVlanDckrIpNet, nil); err != nil { log.Fatal(err) } }