diff --git a/environment/vm/lima/limaconfig/config.go b/environment/vm/lima/limaconfig/config.go index c5313bd6..37159873 100644 --- a/environment/vm/lima/limaconfig/config.go +++ b/environment/vm/lima/limaconfig/config.go @@ -122,6 +122,7 @@ type Network struct { SwitchPortDeprecated uint16 `yaml:"switchPort,omitempty" json:"switchPort,omitempty"` // VDE Switch port, not TCP/UDP port (only used by VDE networking) MACAddress string `yaml:"macAddress,omitempty" json:"macAddress,omitempty"` Interface string `yaml:"interface,omitempty" json:"interface,omitempty"` + Metric uint32 `yaml:"metric,omitempty" json:"metric,omitempty"` } type ProvisionMode = string diff --git a/environment/vm/lima/limautil/network.go b/environment/vm/lima/limautil/network.go index 32e69a22..9b5b2f12 100644 --- a/environment/vm/lima/limautil/network.go +++ b/environment/vm/lima/limautil/network.go @@ -5,9 +5,12 @@ import ( "strings" ) -// network interfaces for shared network in the virtual machine. +// network interface for shared network in the virtual machine. const NetInterface = "col0" +// network metric for the route +const NetMetric = 300 + // IPAddress returns the ip address for profile. // It returns the PTP address if networking is enabled or falls back to 127.0.0.1. // It is guaranteed to return a value. diff --git a/environment/vm/lima/yaml.go b/environment/vm/lima/yaml.go index 33e0dabd..56fcc7f1 100644 --- a/environment/vm/lima/yaml.go +++ b/environment/vm/lima/yaml.go @@ -135,6 +135,7 @@ func newConf(ctx context.Context, conf config.Config) (l limaconfig.Config, err l.Networks = append(l.Networks, limaconfig.Network{ VZNAT: true, Interface: limautil.NetInterface, + Metric: limautil.NetMetric, }) } else { reachableIPAddress, _ = ctx.Value(daemon.CtxKey(vmnet.Name)).(bool) @@ -151,6 +152,7 @@ func newConf(ctx context.Context, conf config.Config) (l limaconfig.Config, err l.Networks = append(l.Networks, limaconfig.Network{ Socket: socketFile, Interface: limautil.NetInterface, + Metric: limautil.NetMetric, }) return nil