From 682720ecd1d8fd34b1cd609f86dc75440a7fbdfb Mon Sep 17 00:00:00 2001 From: Macario Gianpaolo Date: Thu, 7 Dec 2023 09:47:24 +0100 Subject: [PATCH] howto-static-ip-address: Add text Adapted from https://github.com/gmacario/gmhome-network/blob/main/docs/howto-cmprovision-raspinstall01.md#configure-wired-ethernet-with-a-static-ip-address --- docs/howto/howto-static-ip-address.md | 58 ++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/docs/howto/howto-static-ip-address.md b/docs/howto/howto-static-ip-address.md index bdb5dd4..c5d29d0 100644 --- a/docs/howto/howto-static-ip-address.md +++ b/docs/howto/howto-static-ip-address.md @@ -1,5 +1,61 @@ # HOWTO Configure a Static IP Address on Linux -TODO +## Introduction + +This document explains how to configure a static IP address on the Ethernet interface of a Linux host. + +With recent versions of Linux distributions, the network configuration is performed with [NetworkManager](https://wiki.debian.org/NetworkManager). + +**NOTE**: Even though NetworkManager was designed for the Gnome desktop environment, it works "just-fine" also in server editions of those OSs. Checked on the following + +Vendor | OS Name | network-manager | version +-------------|------------------------------------|-----------------|------------------ +Canonical | Ubuntu 22.04 | network-manager | 1.36.6-0ubuntu2 +Raspberry Pi | Raspbian GNU/Linux 10 (buster) | dhcpd5 | 1:8.1.2-1+rpt1 +Raspberry Pi | Debian GNU/Linux 11 (bullseye) | network-manager | 1.30.6-1+deb11u1 +Raspberry Pi | Debian GNU/Linux 12 (bookworm) | network-manager | 1.42.4-1+rpt1 + + + + + + + +Logged in to the host which will act as `raspinstall01` execute the following commands: + +```bash +sudo cp /etc/network/interfaces /etc/network/interfaces.ORIG +sudo vi /etc/network/interfaces/eth0-static +``` + +and write the following contents to the config file: + +```text +# file:/etc/network/interfaces.d/eth0-static + +# Configure static IP address for eth0 +auto eth0 +iface eth0 inet static + address 172.20.0.1 + netmask 255.255.0.0 + +# EOF +``` + +Reboot `raspinstall01` to allow the changes to take effect. + +Login again and verify that `eth0` was assigned the desired IP address: + +```text +gmacario@raspinstall01:~ $ ip address show eth0 +2: eth0: mtu 1500 qdisc mq state DOWN group default qlen 1000 + link/ether e4:5f:01:dd:4c:0e brd ff:ff:ff:ff:ff:ff + inet 172.20.0.1/24 brd 172.20.0.255 scope global eth0 + valid_lft forever preferred_lft forever +gmacario@raspinstall01:~ $ +``` +## See also + +* \ No newline at end of file