net-config
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| net-config [February 10, 2026 at 18:43] – created yanevskiv | net-config [May 14, 2026 at 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | # Network Configuration | ||
| + | This article is about network configuration in [[gnu-linux|GNU/ | ||
| + | ## ifupdown | ||
| + | |||
| + | ### Dynamic configurations | ||
| + | Dynamic configuration with ifupdown (IPv4) | ||
| + | ``` | ||
| + | # / | ||
| + | iface ens3 inet dhcp | ||
| + | ``` | ||
| + | |||
| + | Dynamic configuration with ifupdwon (IPv6) | ||
| + | ``` | ||
| + | iface ens3 inet6 auto | ||
| + | ``` | ||
| + | |||
| + | ### Static configurations | ||
| + | Static configuration with ifupdown (IPv4) | ||
| + | |||
| + | ``` | ||
| + | # / | ||
| + | |||
| + | iface ens3 inet static | ||
| + | address 10.0.1.115 | ||
| + | netmask 255.255.0.0 | ||
| + | gateway 10.0.0.1 | ||
| + | dns-nameservers 1.1.1.1 8.8.8.8 | ||
| + | dns-search example.com | ||
| + | ``` | ||
| + | |||
| + | Static configuration with ifupdown (IPv6) | ||
| + | ``` | ||
| + | iface ens3 inet6 static | ||
| + | address 2001: | ||
| + | netmask 64 | ||
| + | gateway 2001: | ||
| + | dns-nameservers 2606: | ||
| + | ``` | ||
| + | |||
| + | Adding extra routes with ifupdown (`up` and `down` run shell commands) | ||
| + | ``` | ||
| + | iface ens3 inet static | ||
| + | address 10.0.1.115 | ||
| + | netmask 255.255.0.0 | ||
| + | up ip route add 192.168.100.0/ | ||
| + | down ip route del 192.168.100.0/ | ||
| + | ``` | ||
| + | |||
| + | ## systemd-networkd | ||
| + | ``` | ||
| + | [Match] | ||
| + | Name=ens3 | ||
| + | |||
| + | [Network] | ||
| + | Address=10.0.1.115/ | ||
| + | Gateway=10.0.0.1 | ||
| + | DNS=1.1.1.1 | ||
| + | DNS=8.8.8.8 | ||
| + | |||
| + | Address=2001: | ||
| + | Gateway=2001: | ||
| + | DNS=2606: | ||
| + | IPv6AcceptRA=no | ||
| + | |||
| + | [Route] | ||
| + | Destination=192.168.100.0/ | ||
| + | Gateway=10.0.0.2 | ||
| + | ``` | ||
| + | |||
| + | ## Mapping | ||
| + | |||
| + | - `iface ens3 inet dhcp` becomes `DHCP=yes` under `[Network]` section | ||
| + | - `iface ens3 inet6 auto` becomes `IPv6AcceptRA=yes` under `[Network]` section | ||
| + | - `dns-nameservers` becomes `DNS=` under `[Network]` | ||
| + | - `up ip route add` becomes `Destionation=` and `Gateway` under `[Route]` section | ||
