Skip to content

Commit ed38eea

Browse files
committed
fix host network resolver issue with alpine
Signed-off-by: Balaji Vijayakumar <[email protected]>
1 parent 9b1e811 commit ed38eea

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

Diff for: pkg/networks/gvisor.go

+9-3
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,17 @@ func StartGVisorNetstack(ctx context.Context, gVisorOpts *GVisorNetstackOpts) {
3939
protocol = types.QemuProtocol
4040
}
4141

42+
// The way gvisor-tap-vsock implemented slirp is different from tradition SLIRP,
43+
// - GatewayIP handling all request, also answers DNS queries
44+
// - based on NAT configuration, gateway forwards and translates calls to host
45+
// Comparing this with QEMU SLIRP,
46+
// - DNS is equivalent to GatewayIP
47+
// - GatewayIP is equivalent to NAT configuration
4248
config := types.Configuration{
4349
Debug: false,
4450
MTU: opts.MTU,
4551
Subnet: SlirpNetwork,
46-
GatewayIP: SlirpGateway,
52+
GatewayIP: SlirpDNS,
4753
GatewayMacAddress: "5a:94:ef:e4:0c:dd",
4854
DHCPStaticLeases: map[string]string{
4955
SlirpIPAddress: opts.MacAddress,
@@ -54,9 +60,9 @@ func StartGVisorNetstack(ctx context.Context, gVisorOpts *GVisorNetstackOpts) {
5460
DNS: []types.Zone{},
5561
DNSSearchDomains: searchDomains(),
5662
NAT: map[string]string{
57-
SlirpDNS: "127.0.0.1",
63+
SlirpGateway: "127.0.0.1",
5864
},
59-
GatewayVirtualIPs: []string{SlirpDNS},
65+
GatewayVirtualIPs: []string{SlirpGateway},
6066
Protocol: protocol,
6167
}
6268

0 commit comments

Comments
 (0)