bokumin.org

Github

Ultra-lightweight network connection method that does not require a daemon

This article is a translation of the following my article:

 

 

* Translated automatically by Google.
* Please note that some links or referenced content in this article may be in Japanese.
* Comments in the code are basically in Japanese.

 

by bokumin

 

No Daemon Required! Ultra-lightweight Network Connection Method

 

Introduction

 

I have been using network management tools such as NetworkManager and Wicked, but I have now changed to connecting directly to the network using only IP commands. I hope this will be helpful to those who are cutting down on resources in a server environment.

 

Advantages of connecting networks directly

 

Connecting directly to the network has several advantages. First, it doesn’t run any additional daemon processes, which can significantly reduce memory and CPU usage. It also means thatsystem startup time is reduced because network settings are applied immediately without having to wait for services to initialize at boot time. Another big advantage is that configurations are applied directly to the OS’s network stack, eliminating the complexity and unexpected behavior of middle layers. Additionally, it works with a minimal set of tools without relying on any additional daemons or services, allowing you tominimize dependencies. Another important benefit is that automatic adjustment prevents unintentional configuration changes, resulting in predictable behavior.
I think this kind of simple structuring is very effective, especially in server environments with limited resources, and is perfect for home servers and embedded systems.

 

Setting method

 

I will introduce the scripts I actually created. OpenSUSE Tumbleweed uses systemd, so this is done with the systemd unit. The settings are different for systems such as systemV, but you can easily create init scripts there as well.
First, stop all currently running network management tools.

 

sudo systemctl stop wicked
sudo systemctl disable wicked

sudo systemctl stop NetworkManager
sudo systemctl disable NetworkManager

 

Next, we will create a script to make an IP connection to /usr/local/bin.

 

$ cat /usr/local/bin/setup-network.sh

#!/bin/bash

# IPとネットマスクを設定
ip addr add 192.168.3.10/24 dev eno1

# 有効化
ip link set dev eno1 up

# デフォルトゲートウェイの設定
ip route add default via 192.168.3.1

# ネームサーバの設定
echo "nameserver 8.8.8.8" > /etc/resolv.conf

 

If you want to create it using ifconfig or route command, create it as follows.

 

$ cat /usr/local/bin/setup-network.sh

#!/bin/bash
# IPとネットマスクを設定し、インターフェースを有効化
ifconfig eno1 192.168.3.10 netmask 255.255.255.0 up

# デフォルトゲートウェイの設定
route add default gw 192.168.3.1

# ネームサーバの設定
echo "nameserver 8.8.8.8" > /etc/resolv.conf

 

We will create a service (oneshot) that executes a command only once in systemd.

 

$ cat /etc/systemd/system/manual-network.service

[Unit]
Description=Manual Network Configuration
After=network-pre.target
Before=network.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/setup-network.sh
RemainAfterExit=yes
User=root

[Install]
WantedBy=network.target

 

Enable the created service.

 

$ sudo systemctl enable manual-network.service
$ sudo systemctl start manual-network.service

 

Please check whether the created service unit was executed without any problems

 

$ sudo systemctl status manual-network.service

 manual-network.service - Manual Network Configuration
     Loaded: loaded (/etc/systemd/system/manual-network.service; enabled; preset: disabled)
     Active: active (exited) since Sun 2025-05-04 03:38:24 JST; 10h ago
 Invocation: 272ca0a8300b46fc965f72285f472aa0
    Process: 1550 ExecStart=/usr/local/bin/setup-network.sh (code=exited, status=0/SUCCESS)
   Main PID: 1550 (code=exited, status=0/SUCCESS)
        CPU: 67ms

May 04 03:38:24 hogehoge systemd[1]: Starting Manual Network Configuration...
May 04 03:38:24 hogehoge systemd[1]: Finished Manual Network Configuration.

 

Check if you are actually connected to the internet, and if there are no problems, the process is complete.

 

$ ip a sh dev eno1
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether f4:6d:04:3b:82:55 brd ff:ff:ff:ff:ff:ff
    altname enp0s25
    altname enxf46d043b8255
    inet 192.168.3.10/24 scope global eno1
       valid_lft forever preferred_lft forever
    inet6 fe80::f66d:4ff:fe3b:8255/64 scope link proto kernel_ll 
       valid_lft forever preferred_lft forever


$ ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=116 time=9.90 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=116 time=9.74 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=116 time=10.2 ms

--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 9.735/9.935/10.173/0.180 ms

 

At the end

 

In recent years, many automation features and abstraction layers have been introduced in modern system environments to improve user convenience. However, behind this “convenience”, many daemon processes are constantly running and consuming resources. Personally, I did this because I like being able to fully understand and control what’s going on in my system.

 

Network management tools like NetworkManager and Wicked are certainly quite useful, but the trade-off for their usefulness is that they keep complex processes running in the background, sometimes causing unexpected behavior. The method we introduced here for managing networks with direct IP commands increases system transparency and control, and adheres to the “minimum necessary” principle.

 

Especially in server environments and embedded systems, eliminating redundant processes reduces security risks, improves resource efficiency, and improves overall system stability. In other words, simple is the best and strongest.

 

In the end, it is important to choose the method that best suits your environment and needs, but I believe that by choosing a simple and transparent method, you can truly treat your computer as “your own” rather than using a black box system where you don’t know what is going on behind the scenes.

 

End