@@ -12,6 +12,7 @@ import (
1212 "github.com/AkihiroSuda/lima/pkg/downloader"
1313 "github.com/AkihiroSuda/lima/pkg/iso9660util"
1414 "github.com/AkihiroSuda/lima/pkg/limayaml"
15+ "github.com/AkihiroSuda/lima/pkg/qemu/qemuconst"
1516 "github.com/AkihiroSuda/lima/pkg/store/filenames"
1617 "github.com/docker/go-units"
1718 "github.com/mattn/go-shellwords"
@@ -193,8 +194,8 @@ func Cmdline(cfg Config) (string, []string, error) {
193194 args = append (args , "-cdrom" , filepath .Join (cfg .InstanceDir , filenames .CIDataISO ))
194195
195196 // Network
196- // CIDR is intentionally hardcoded to 192.168.5.0/24, as each of QEMU has its own independent slirp network.
197- args = append ( args , "-netdev" , fmt . Sprintf ( "user,id=net0,net=192.168.5.0/24,hostfwd=tcp:127.0.0.1:%d-:22" , y .SSH .LocalPort ))
197+ args = append ( args , "-netdev" , fmt . Sprintf ( "user,id=net0,net=%s,dhcpstart=%s,hostfwd=tcp:127.0.0.1:%d-:22" ,
198+ qemuconst . SlirpNetwork , qemuconst . SlirpIPAddress , y .SSH .LocalPort ))
198199 args = append (args , "-device" , "virtio-net-pci,netdev=net0,mac=" + limayaml .MACAddress (cfg .InstanceDir ))
199200 for i , vde := range y .Network .VDE {
200201 // VDE4 accepts VNL like vde:///var/run/vde.ctl as well as file path like /var/run/vde.ctl .
0 commit comments