ALT Linux Distributions development
 help / color / mirror / Atom feed
* [devel-distro] dhcp4 only for use/net-eth
@ 2021-12-04 21:14 Konstantin Lepikhov
  2021-12-06  6:50 ` Антон Мидюков
  0 siblings, 1 reply; 2+ messages in thread
From: Konstantin Lepikhov @ 2021-12-04 21:14 UTC (permalink / raw)
  To: devel-distro

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

Привет!

Иногда бывает полезно запретить networkd проявлять сообразительность и
пытаться конфигурировать сеть для всех протоколов. Для таких случаев
сделал dhcp4 вариант, который настраивает только ipv4 dhcp и запрещает
ipv6.

-- 
WBR et al.

[-- Attachment #2: 0093-use-net-eth-add-dhcp-ipv4-only-support-for-networkd.patch --]
[-- Type: text/x-patch, Size: 1950 bytes --]

>From 5a1ca2562f630821f768c8cdf1072388a3ab55da Mon Sep 17 00:00:00 2001
From: "Konstantin A. Lepikhov" <lakostis@altlinux.ru>
Date: Sat, 4 Dec 2021 14:52:57 +0100
Subject: [PATCH 93/94] use/net-eth: add dhcp ipv4 only support for networkd

---
 features.in/net-eth/config.mk                 |  3 +++
 .../net-eth/rootfs/image-scripts.d/50-net-eth | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/features.in/net-eth/config.mk b/features.in/net-eth/config.mk
index dafd3a7f..6fa0b4df 100644
--- a/features.in/net-eth/config.mk
+++ b/features.in/net-eth/config.mk
@@ -25,4 +25,7 @@ use/net-eth/dhcp/timeout/%: use/net-eth/dhcp
 use/net-eth/networkd-dhcp: use/net-eth/networkd
 	@$(call add,NET_ETH,eth0:dhcp)
 
+use/net-eth/networkd-dhcp4: use/net-eth/networkd
+	@$(call add,NET_ETH,eth0:dhcp4)
+
 # use e.g. eth0:static:10.0.0.2/24:10.0.0.1 for predefined static configuration
diff --git a/features.in/net-eth/rootfs/image-scripts.d/50-net-eth b/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
index 92bde492..51c12b29 100755
--- a/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
+++ b/features.in/net-eth/rootfs/image-scripts.d/50-net-eth
@@ -22,7 +22,7 @@ SYSTEMD_IFDIR="/etc/systemd/network"
 
 write_iface() {
 	case "$proto" in
-	dhcp)
+	dhcp*)
 		;;
 	static)
 		[ -n "$ipv4addr" ] || fatal "ipv4addr missing"
@@ -41,7 +41,7 @@ write_etcnet_iface() {
 	mkdir -p "$dir"
 	append=
 	case "$proto" in
-	dhcp)
+	dhcp*)
 		append="DHCP_TIMEOUT=$GLOBAL_NET_ETH_TIMEOUT"
 		;;
 	static)
@@ -62,6 +62,21 @@ write_etcnet_iface() {
 
 write_systemd_iface() {
 	case "$proto" in
+	dhcp4)
+		echo "[Match]"
+		echo "Name=$iface"
+		echo
+		echo "[Network]"
+		echo "DHCP=ipv4"
+		echo "IPv6AcceptRA=no"
+		echo "LinkLocalAddressing=ipv4"
+		echo
+		echo "[DHCP]"
+		echo "UseMTU=yes"
+		echo "UseDomains=yes"
+		echo "UseNTP=yes"
+		echo
+		;;
 	dhcp)
 		echo "[Match]"
 		echo "Name=$iface"
-- 
2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [devel-distro] dhcp4 only for use/net-eth
  2021-12-04 21:14 [devel-distro] dhcp4 only for use/net-eth Konstantin Lepikhov
@ 2021-12-06  6:50 ` Антон Мидюков
  0 siblings, 0 replies; 2+ messages in thread
From: Антон Мидюков @ 2021-12-06  6:50 UTC (permalink / raw)
  To: devel-distro

05.12.2021 04:14, Konstantin Lepikhov пишет:
> Привет!
> 
> Иногда бывает полезно запретить networkd проявлять сообразительность и
> пытаться конфигурировать сеть для всех протоколов. Для таких случаев
> сделал dhcp4 вариант, который настраивает только ipv4 dhcp и запрещает
> ipv6.
> 

Патч принял. Может кому-то пригодится.


-- 
С уважением, Антон Мидюков <antohami@altlinux.org>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-12-06  6:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 21:14 [devel-distro] dhcp4 only for use/net-eth Konstantin Lepikhov
2021-12-06  6:50 ` Антон Мидюков

ALT Linux Distributions development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-distro/0 devel-distro/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-distro devel-distro/ http://lore.altlinux.org/devel-distro \
		devel-distro@lists.altlinux.org devel-distro@lists.altlinux.ru devel-distro@lists.altlinux.com
	public-inbox-index devel-distro

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-distro


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git