Skip to content
New issue

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

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

Already on GitHub? # to your account

net: set route for external address #1214

Merged
merged 1 commit into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions environment/vm/lima/limaconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion environment/vm/lima/limautil/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions environment/vm/lima/yaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
Loading