-
Notifications
You must be signed in to change notification settings - Fork 621
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
Add networking options for vde_vmnet support #133
Conversation
I think I've addressed all comments now. I don't know how I can force QEMU to use eth0 for vde and eth1 for slirp; any suggestions? |
Signed-off-by: Jan Dubois <jan.dubois@suse.com>
Thanks, but the slirp eth does not link up for me suda@lima-default:~$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 22:34:71:8a:4e:62 brd ff:ff:ff:ff:ff:ff
inet 192.168.105.3/24 brd 192.168.105.255 scope global dynamic enp0s1
valid_lft 85382sec preferred_lft 85382sec
inet6 fd69:599c:c913:ae3f:2034:71ff:fe8a:4e62/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 2591992sec preferred_lft 604792sec
inet6 fe80::2034:71ff:fe8a:4e62/64 scope link
valid_lft forever preferred_lft forever
3: enp0s2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff Config: the default template but |
I'll take a look; I've done all my testing with a modified Alpine image (just added an entry for |
https://cloudinit.readthedocs.io/en/latest/topics/network-config.html#fallback-network-configuration
Looks like it only enables the first interface by default. So we need to generate network config explicitly 😞 https://cloudinit.readthedocs.io/en/latest/topics/network-config-format-v2.html#examples |
Yes, that's what I've been thinking too. I will try if a simple config is going to work:
|
d287fe6
to
efe806f
Compare
@AkihiroSuda you said (on Slack): "vde will be eth0 and slirp will be eth1". Does it really matter? If not then I would prefer to always use |
SGTM |
Signed-off-by: Jan Dubois <jan.dubois@suse.com>
I've updated the PR to allow the specification of multiple interfaces (e.g. both a host and a bridged network). For testing I defined 2 interfaces on the same vde_switch (which doesn't make much sense, but shows the feature): network:
vde:
- url: "/var/run/vde.ctl"
- url: "/var/run/vde.ctl"
name: "yo0" With the $ lima ip addr
bash: line 1: cd: /Users/jan/suse/lima: No such file or directory
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 22:11:11:11:11:11 brd ff:ff:ff:ff:ff:ff
altname enp0s1
inet 192.168.5.15/24 brd 192.168.5.255 scope global dynamic eth0
valid_lft 85741sec preferred_lft 85741sec
3: vde0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 22:0b:6d:67:d6:48 brd ff:ff:ff:ff:ff:ff
altname enp0s2
inet 192.168.105.11/24 brd 192.168.105.255 scope global dynamic vde0
valid_lft 84877sec preferred_lft 84877sec
4: yo0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 22:59:7a:b1:ad:46 brd ff:ff:ff:ff:ff:ff
altname enp0s3
inet 192.168.105.10/24 brd 192.168.105.255 scope global dynamic yo0
valid_lft 84877sec preferred_lft 84877sec This required some refactoring, as |
Signed-off-by: Jan Dubois <jan.dubois@suse.com>
vde := &y.Network.VDE[i] | ||
if vde.MACAddress == "" { | ||
// every interface in every limayaml file must get its own unique MAC address | ||
uniqueID := fmt.Sprintf("%s#%d", filePath, i) |
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.
We should also put host UUID to avoid MAC collision when multiple Mac hosts with bridged mode are connected to the same physical network. (Can be another PR)
I guess we can just use hostname instead, but UUID seems more stable than hostname.
We should probably also put user ID to the hasher.
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.
We should also put host UUID to avoid MAC collision when multiple Mac hosts with bridged mode are connected to the same physical network. (Can be another PR)
I've create #135 for this. Does it make sense to use VDE on Linux too?
We should probably also put user ID to the hasher.
Why would we need this; the full path to the lima.yaml
file is already unique for each machine. If 2 users refer to the same config file, they will refer to the same instance. Also for regular operation the filename already includes the user name: /Users/$USER/.lima/$INSTANCE/lima.yaml
.
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, merging and I'll open a follow-up PR to cover #135
Ref #81