Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT]: docs/howto: Add "HOWTO Configure a Static IP Address on Linux" #373

Merged
merged 5 commits into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions docs/howto/howto-static-ip-address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# HOWTO Configure a Static IP Address on Linux

## 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

<!-- textlint-disable -->
<!-- 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> -->
<!-- textlint-enable -->

<!-- (2023-11-24 14:30 CET) -->

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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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

* <https://www.baeldung.com/linux/set-static-ip-address>

<!-- EOF -->
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ gone through during the project realization.
* **For Embedded electronics enthusiast**:
* :doc:`howto/howto-control-rpi-poweredup`
* :doc:`howto/howto-install-raspios64`
* :doc:`howto/howto-static-ip-address`
* :doc:`howto/howto-prepare-rpi4b-for-arneis`
* :doc:`howto/howto-install-micropython-nano33ble`
* :doc:`howto/howto-getting-started-foundriesio`
Expand Down Expand Up @@ -163,6 +164,7 @@ gone through during the project realization.

howto/howto-control-rpi-poweredup
howto/howto-install-raspios64
howto/howto-static-ip-address
howto/howto-prepare-rpi4b-for-arneis
howto/howto-install-micropython-nano33ble
howto/howto-getting-started-foundriesio
Expand Down