Skip to content

Commit 201b870

Browse files
authored
Merge pull request #373 from B-AROL-O/feat/ubuntu-static-ip
[FEAT]: docs/howto: Add "HOWTO Configure a Static IP Address on Linux"
2 parents 920b6a8 + 58d0e3c commit 201b870

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# HOWTO Configure a Static IP Address on Linux
2+
3+
## Introduction
4+
5+
This document explains how to configure a static IP address on the Ethernet interface of a Linux host.
6+
7+
With recent versions of Linux distributions, the network configuration is performed with [NetworkManager](https://wiki.debian.org/NetworkManager).
8+
9+
Ubuntu configures networking through a higher abstraction tool called [Netplan](https://netplan.io/) which internally invokes NetworkManager as a renderer.
10+
11+
## Reference documents
12+
13+
* <https://www.baeldung.com/linux/set-static-ip-address>
14+
* [Netplan documentation](https://netplan.readthedocs.io/)
15+
* [NetworkManager - Debian WIki](https://wiki.debian.org/NetworkManager)
16+
* [Ubuntu Forum: Need advice: Redoing networking on an old server?](https://ubuntuforums.org/showthread.php?t=2478425)
17+
18+
<!--
19+
TODO: Integrate @OrsoEric notes from section "4a) ETH0 Static IP" of
20+
<https://arol.atlassian.net/l/cp/01AGbw4N>
21+
22+
TODO: Integrate @alv67 notes from <https://arol.atlassian.net/l/cp/PSbCAVjP>
23+
-->
24+
25+
## Configuring Netplan
26+
27+
From <https://netplan.io>:
28+
29+
> Netplan is a utility for easily configuring networking on a linux system.
30+
> You simply create a YAML description of the required network interfaces and what each should be configured to do.
31+
> From this description Netplan will generate all the necessary configuration for your chosen renderer tool.
32+
33+
TODO
34+
35+
## Configuring NetworkManager
36+
37+
**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
38+
39+
Vendor | OS Name | network-manager | version
40+
-------------|------------------------------------|-----------------|------------------
41+
Canonical | Ubuntu 22.04 | network-manager | 1.36.6-0ubuntu2
42+
Raspberry Pi | Raspbian GNU/Linux 10 (buster) | dhcpd5 | 1:8.1.2-1+rpt1
43+
Raspberry Pi | Debian GNU/Linux 11 (bullseye) | network-manager | 1.30.6-1+deb11u1
44+
Raspberry Pi | Debian GNU/Linux 12 (bookworm) | network-manager | 1.42.4-1+rpt1
45+
46+
<!-- textlint-disable -->
47+
<!-- TODO: Check on Red Hat Enterprise Linux 8: <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/index> -->
48+
<!-- textlint-enable -->
49+
50+
<!-- (2023-11-24 14:30 CET) -->
51+
52+
Logged in to the host which will act as `raspinstall01` execute the following commands:
53+
54+
```bash
55+
sudo cp /etc/network/interfaces /etc/network/interfaces.ORIG
56+
sudo vi /etc/network/interfaces/eth0-static
57+
```
58+
59+
and write the following contents to the config file:
60+
61+
```text
62+
# file:/etc/network/interfaces.d/eth0-static
63+
64+
# Configure static IP address for eth0
65+
auto eth0
66+
iface eth0 inet static
67+
address 172.20.0.1
68+
netmask 255.255.0.0
69+
70+
# EOF
71+
```
72+
73+
Reboot `raspinstall01` to allow the changes to take effect.
74+
75+
Login again and verify that `eth0` was assigned the desired IP address:
76+
77+
```text
78+
gmacario@raspinstall01:~ $ ip address show eth0
79+
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
80+
link/ether e4:5f:01:dd:4c:0e brd ff:ff:ff:ff:ff:ff
81+
inet 172.20.0.1/24 brd 172.20.0.255 scope global eth0
82+
valid_lft forever preferred_lft forever
83+
gmacario@raspinstall01:~ $
84+
```
85+
86+
<!-- EOF -->

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ gone through during the project realization.
135135
* **For Embedded electronics enthusiast**:
136136
* :doc:`howto/howto-control-rpi-poweredup`
137137
* :doc:`howto/howto-install-raspios64`
138+
* :doc:`howto/howto-static-ip-address`
138139
* :doc:`howto/howto-prepare-rpi4b-for-arneis`
139140
* :doc:`howto/howto-install-micropython-nano33ble`
140141
* :doc:`howto/howto-getting-started-foundriesio`
@@ -163,6 +164,7 @@ gone through during the project realization.
163164

164165
howto/howto-control-rpi-poweredup
165166
howto/howto-install-raspios64
167+
howto/howto-static-ip-address
166168
howto/howto-prepare-rpi4b-for-arneis
167169
howto/howto-install-micropython-nano33ble
168170
howto/howto-getting-started-foundriesio

0 commit comments

Comments
 (0)