File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -500,12 +500,14 @@ extension LinuxContainer {
500500 // For every interface asked for:
501501 // 1. Add the address requested
502502 // 2. Online the adapter
503- // 3. Add the gateway address
504503 for (index, i) in self . interfaces. enumerated ( ) {
505504 let name = " eth \( index) "
506505 try await agent. addressAdd ( name: name, address: i. address)
507506 try await agent. up ( name: name)
508- try await agent. routeAddDefault ( name: name, gateway: i. gateway)
507+ }
508+ // Configure the gateway only on the first interface
509+ if !self . interfaces. isEmpty {
510+ try await agent. routeAddDefault ( name: " eth0 " , gateway: self . interfaces [ 0 ] . gateway)
509511 }
510512 if let dns = self . dns {
511513 try await agent. configureDNS ( config: dns, location: rootfs. destination)
You can’t perform that action at this time.
0 commit comments