Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for native docker networking #188

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

networkop
Copy link

Hey Kristian,
I've got your images working with native docker networking (main goal being to run it inside k8s). As I've said it only took a few minor changes to vrnetlab.py + small changes to individual launch.py to pass the flag at runtime. I've tried attaching VMs via macvtap but it doesn't seem to work from inside the container so I've resorted to plain-old eth-bridge-tap (which means that spanning-tree won't work).
Have a look, tell me what you think. I'm getting back to work now so I didn't have time to run large-scale tests yet. So far I've tested it with a simple script connecting CSR/XRV and vMX back-to-back (example for vmx):

docker create --name vmx --privileged vrnetlab/vr-vmx:17.2R1.13 --meshnet
docker network connect net1 vmx
docker network connect net2 vmx
docker network connect net3 vmx
docker start vmx

@plajjan
Copy link
Collaborator

plajjan commented Jan 13, 2019

Thanks! I need to test this. I won't have time in the coming weeks due to travel but rest assured it's not ignored! :)

@networkop
Copy link
Author

sure, let me know if you need help setting things up. I've just tested it with a mix of 40 VMX and CSR VM-pods and it seems to be working fine. I'll write up a blogpost about this in the meantime, to close the loop and document everything before i forget.

@tahir24434
Copy link
Contributor

Any update on merging this patch?

@tahir24434
Copy link
Contributor

I want to share an update as it might be helpful.
I tested this change on K8s cluster using VMX vmx-bundle-17.2R1.13.tgz. These changes worked fine for me.
Thanks for the project.

@mbound
Copy link

mbound commented Nov 25, 2019

This would be great to merge, any chance that this mechanism could also be applied to the management network as an option?
I've tested it with vMX 18.4 and it works.

@kitos9112
Copy link

I second this PR as well. Could any contributor take a look into it for a formal approval?

@bdreisbach
Copy link

ive been playing around with this patch and have run in to an interesting problem. when attaching networks to containers, it does not seem to present them to the container in the order in which they were added. it seems to be doing an alphabetical sort or something. has anyone else seen this and/or know how to "fix" it. I've tried using docker-compose and network priorities but that doesnt seem to work either.

@networkop
Copy link
Author

@bdreisbach I think you may be hitting this? https://networkop.co.uk/post/2018-03-03-docker-multinet/
I thought this was resolved but I may be mistaken.
workaround is to not use docker API to attach networks. either plumb them in manually or use some external orchestrator.

@bdreisbach
Copy link

what do you mean plumb them in manually exactly?

apparently not this?

bradd@eng34:~$ docker create --name test -it alpine sh
afc1c1c510cbd66df5c2e378ded89a9823a795496ffc61db43fc7bd8cefc276e
bradd@eng34:~$ docker network connect net1 test
bradd@eng34:~$ docker network connect net3 test
bradd@eng34:~$ docker network connect net2 test
bradd@eng34:~$ docker network inspect -f "{{range .IPAM.Config }}{{.Subnet}}{{end}}" net1
192.168.112.0/20
bradd@eng34:~$ docker network inspect -f "{{range .IPAM.Config }}{{.Subnet}}{{end}}" net2
192.168.128.0/20
bradd@eng34:~$ docker network inspect -f "{{range .IPAM.Config }}{{.Subnet}}{{end}}" net3
192.168.144.0/20
bradd@eng34:~$ docker start test
test
bradd@eng34:~$ docker exec -it test sh -c "ip a | grep 'inet'"
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
    inet 172.17.0.2/16 brd 172.17.255.255 scope global eth0
    inet6 fc00::242:ac11:2/64 scope global flags 02
    inet6 fe80::42:acff:fe11:2/64 scope link
    inet 192.168.112.2/20 brd 192.168.127.255 scope global eth1
    inet 192.168.144.2/20 brd 192.168.159.255 scope global eth3
    inet 192.168.128.2/20 brd 192.168.143.255 scope global eth2

i'd expect 192.168.144 to be on eth2.

@networkop
Copy link
Author

No, your example above is done using docker API.
I mean something like this https://stackoverflow.com/questions/31907117/how-to-connect-docker-containers-without-a-bridge
or, apologies for a shameless plug, docker-topo or k8s-topo

@bdreisbach
Copy link

thanks for the pointer. it actually seems to "work" as i expect if i start the containers first, and then add the networks.

@rnwolfe
Copy link

rnwolfe commented Apr 14, 2021

another vote for getting this merged in with more recent vrnetlab commits 👍

@hellt
Copy link

hellt commented Apr 14, 2021

@rnwolfe you may want to check out containerlab that builds on top of that idea

@rnwolfe
Copy link

rnwolfe commented Apr 17, 2021

@hellt thanks for pointing that out - seems very powerful. Just finished reading through your twitter announcement thread.

This could be a good route for me to pursue using, but curious about extending it into k8s?

@hellt
Copy link

hellt commented Apr 17, 2021

@rnwolfe you may try k8s-topo for that, I haven't tried myself...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants