- 
                Notifications
    
You must be signed in to change notification settings  - Fork 510
 
Support --subnet in network create #737
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
Support --subnet in network create #737
Conversation
| 
           @siikamiika Thank you for the PR! 
 Could you give a concrete example of this? Are you referring to a network that exists on your Mac that was created by an app other than   | 
    
| 
           Explaining the process to myself to make sure I understand it: 
 I don't think it's checking if any existing networks for interfaces like LAN or VPN overlap the created network.  Who's responsible for making sure container networks don't overlap with other networks? 
 If it's the user, then this change should be ok in my opinion, but there could be a bug in the default mode where the network address is chosen automatically  If it's container, getifaddrs could maybe be used to query active networks and compared to the new configuration. But how early should it be caught? Client or server? The rest are out of my reach. edit: verified automatically addressed container networks can also overlap existing ones not created by it: (en12 is a usb ethernet adapter connected to a router and bridge100 is the vmnet bridge) en12 network was unavailable while bridge100 was active but came back when I stopped the container and bridge100 disappeared.  | 
    
| 
           @siikamiika That's some really nice foresight to call out the network shadowing challenge, and some useful analysis as well. 
 Your understanding of the flow looks solid, and you are 100% correct: 
 As I mentioned your analysis is useful because it seems to indicate that vmnet might not be doing the validation I thought it would. Can you confirm that that Ethernet interface was up with the assigned subnet prior to your creating the NAT bridge with the overlapping subnet? I'll have an internal chat with some associates and see if we can get to the bottom of this. As far as the PR, I think that what I described above means that what you've written should be sufficient. I'm talking tomorrow off but if someone else can't review this, I'll do so after the weekend. Thanks for the contribution!  | 
    
| 
           There will be one case btw that will be pretty much impossible to prevent: 
  | 
    
Currently containerization only supports IPv4 Fixes apple#458
c0297ce    to
    527964a      
    Compare
  
    
          
 Yes. I just verified it again to be sure. 
 This also happens if I start with container system stopped and then disconnect my Wi-Fi, configure my offline USB ethernet connected test router to use 192.168.64.0/24, start container system and run a container with the default network. I'll end up with two networks in 192.168.64.0/24. Same if I connect to the test router's Wi-Fi. 
 Good point, it's also a problem the other way around. This became even more interesting. If I have a container running in the 192.168.66.0/24 network and try to connect to the router with USB ethernet, I won't get an IP address from the router before I close the container (removing the bridge100 interface) and waiting for DHCP to do its thing again without the conflicting network active. After that I can restart the container and everything works like in the original steps starting from "(see below)". 192.168.0.0-192.168.255.255 is quite crowded but I don't know if defaulting to some other private range would be any better. Signature was missing from my commit, I've rebased and signed my commit now. Thanks for your help!  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @siikamiika, this looks good to me.
Just wanted to make sure that AllocationOnlyVmnetNetwork fails when you try to run container-network-vmnet start --subnet some-cidr and it does.
          
 More about all of this to explain where things are for anyone that wants to know a bit more: 
  | 
    
Caution
Just noticed you can actually create a network that conflicts with an existing network not managed by
network create. Unless that is fine do not merge!Currently containerization only supports IPv4.
Example:

Docker ref: https://docs.docker.com/reference/cli/docker/network/create/
Podman ref: https://docs.podman.io/en/v5.0.3/markdown/podman-network-create.1.html#subnet-subnet
Fixes #458
Type of Change
Motivation and Context
[Why is this change needed?]
Scripted creation of deterministic network environments for containers
Testing