[PR #719] [MERGED] Add manual network interface configuration for multi-NIC Docker environments #764

Closed
opened 2025-10-31 15:21:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/moghtech/komodo/pull/719
Author: @MP-Tool
Created: 8/7/2025
Status: Merged
Merged: 8/9/2025
Merged by: @mbecker20

Base: 1.18.5Head: dev-1-multi-nic


📝 Commits (9)

  • 6a126af Add iproute2 to debian-debs
  • 93a7540 feat: Add manual network interface configuration for multi-NIC support
  • 8aca0ef fix: Update internet interface handling for multi-NIC support
  • b152f02 refactor: Enhance error messages and logging in networking module
  • 3a42a45 refactor: Simplify interface argument handling and improve logging in network configuration and cleanup
  • fb825e7 refactor(network): simplify startup integration and improve error handling
  • 808a522 fix(config): update default internet interface setting
  • ab432a5 fix(config): remove custom default for internet interface in CoreConfig
  • ab38397 move mod.rs -> network.rs

📊 Changes

7 files changed (+278 additions, -1 deletions)

View changed files

📝 bin/core/debian-deps.sh (+1 -1)
📝 bin/core/src/config.rs (+1 -0)
📝 bin/core/src/main.rs (+1 -0)
bin/core/src/network.rs (+258 -0)
📝 bin/core/src/startup.rs (+4 -0)
📝 client/core/rs/src/entities/config/core.rs (+8 -0)
📝 config/core.config.toml (+5 -0)

📄 Description

Problem

In Docker setups with multiple network interfaces, users cannot specify which interface should handle internet traffic, leading to unpredictable routing behavior. This causes problems when working with external hosted repositories. While Docker Compose version 2.32+ provides network interface priority gw_priority settings (which I recommend using bevor), some edge case scenarios require the ability to manually set the container interface for the default gateway.

Solution

Added internet_interface configuration allows manual specification of which network interface of the container should be used as the default gateway. The feature automatically detects Docker environments and configures the routing table to route internet traffic through the specified interface.

How it works:

  1. Validates the specified interface exists and is UP
  2. Discovers the gateway for the interface's network
  3. Sets the interface as the default route for internet traffic
  4. Provides clear error messages if privileges or configuration are missing

Usage

# config/core.config.toml
internet_interface = "eth1"
# docker-compose.yaml
services:
  core:
    cap_add: [NET_ADMIN]
    environment:
      KOMODO_INTERNET_INTERFACE: "eth1"

Changes

  • New: mod.rs - Network configuration module
  • Modified: Core config to support internet_interface field
  • Modified: Startup integration for network setup

Requirements

  • NET_ADMIN capability for Docker containers
  • iproute2 (injected by debian-deps.sh)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/moghtech/komodo/pull/719 **Author:** [@MP-Tool](https://github.com/MP-Tool) **Created:** 8/7/2025 **Status:** ✅ Merged **Merged:** 8/9/2025 **Merged by:** [@mbecker20](https://github.com/mbecker20) **Base:** `1.18.5` ← **Head:** `dev-1-multi-nic` --- ### 📝 Commits (9) - [`6a126af`](https://github.com/moghtech/komodo/commit/6a126af1bd37d4e4313e5f8fcf877a1a0a8221c6) Add iproute2 to debian-debs - [`93a7540`](https://github.com/moghtech/komodo/commit/93a75404c18da22a28b1057e3d7545691ac530e1) feat: Add manual network interface configuration for multi-NIC support - [`8aca0ef`](https://github.com/moghtech/komodo/commit/8aca0ef96ddd4e2ab32c480ff89ee4696ad9903e) fix: Update internet interface handling for multi-NIC support - [`b152f02`](https://github.com/moghtech/komodo/commit/b152f02f779a225fae29e187dcba23ed92b04d60) refactor: Enhance error messages and logging in networking module - [`3a42a45`](https://github.com/moghtech/komodo/commit/3a42a45fe126d31ea468f9283ac72f881e2512c9) refactor: Simplify interface argument handling and improve logging in network configuration and cleanup - [`fb825e7`](https://github.com/moghtech/komodo/commit/fb825e7a085eac0795674766acb91264d631656a) refactor(network): simplify startup integration and improve error handling - [`808a522`](https://github.com/moghtech/komodo/commit/808a522adf456179f3336f44ae70f058b84ad2a2) fix(config): update default internet interface setting - [`ab432a5`](https://github.com/moghtech/komodo/commit/ab432a5c29778dba37c19877b7566f087ab98e13) fix(config): remove custom default for internet interface in CoreConfig - [`ab38397`](https://github.com/moghtech/komodo/commit/ab38397894578a1f42d1ff7cabf3cdd9b7ec7bd1) move mod.rs -> network.rs ### 📊 Changes **7 files changed** (+278 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `bin/core/debian-deps.sh` (+1 -1) 📝 `bin/core/src/config.rs` (+1 -0) 📝 `bin/core/src/main.rs` (+1 -0) ➕ `bin/core/src/network.rs` (+258 -0) 📝 `bin/core/src/startup.rs` (+4 -0) 📝 `client/core/rs/src/entities/config/core.rs` (+8 -0) 📝 `config/core.config.toml` (+5 -0) </details> ### 📄 Description # Problem In Docker setups with multiple network interfaces, users cannot specify which interface should handle internet traffic, leading to unpredictable routing behavior. This causes problems when working with external hosted repositories. While Docker Compose version `2.32+` provides network interface priority `gw_priority` settings (which I recommend using bevor), some edge case scenarios require the ability to manually set the container interface for the default gateway. # Solution Added `internet_interface` configuration allows manual specification of which network interface of the container should be used as the default gateway. The feature automatically detects Docker environments and configures the routing table to route internet traffic through the specified interface. ## How it works: 1. Validates the specified interface exists and is UP 2. Discovers the gateway for the interface's network 3. Sets the interface as the default route for internet traffic 4. Provides clear error messages if privileges or configuration are missing # Usage ``` # config/core.config.toml internet_interface = "eth1" ``` ``` # docker-compose.yaml services: core: cap_add: [NET_ADMIN] environment: KOMODO_INTERNET_INTERFACE: "eth1" ``` # Changes - New: mod.rs - Network configuration module - Modified: Core config to support internet_interface field - Modified: Startup integration for network setup # Requirements - `NET_ADMIN` capability for Docker containers - iproute2 (injected by debian-deps.sh) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the
pull-request
label 2025-10-31 15:21:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#764
No description provided.