Skip to content

Commit

Permalink
net: set route for external address (#1214)
Browse files Browse the repository at this point in the history
Signed-off-by: Abiola Ibrahim <[email protected]>
  • Loading branch information
abiosoft authored Dec 15, 2024
1 parent 70ca03b commit e11bb7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
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

0 comments on commit e11bb7a

Please sign in to comment.