unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* How can I have a static IP on one NIC and DHCP on the other?
@ 2021-01-05 21:49 Katherine Cox-Buday
  2021-01-05 22:08 ` divoplade
  0 siblings, 1 reply; 2+ messages in thread
From: Katherine Cox-Buday @ 2021-01-05 21:49 UTC (permalink / raw)
  To: help-guix

Is it possible to define an operating-system which runs DHCP on one NIC,
and has a static address on the other?

I'm getting:

guix system: error: service 'networking' provided more than once

if i try and define service for dhcp-client-service-type and
static-networking-service.

-- 
Katherine


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

* Re: How can I have a static IP on one NIC and DHCP on the other?
  2021-01-05 21:49 How can I have a static IP on one NIC and DHCP on the other? Katherine Cox-Buday
@ 2021-01-05 22:08 ` divoplade
  0 siblings, 0 replies; 2+ messages in thread
From: divoplade @ 2021-01-05 22:08 UTC (permalink / raw)
  To: Katherine Cox-Buday, help-guix

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

Hello Katherine,

Le mardi 05 janvier 2021 à 15:49 -0600, Katherine Cox-Buday a écrit :
> Is it possible to define an operating-system which runs DHCP on one
> NIC,
> and has a static address on the other?

For a slightly different problem (adding a static ipv6 on the same
interface, [1]), I ended up creating a service that just did "ip
address add dev <device> <address>" on startup, and it seems to work.
Maybe you can do something similar? The "ip" program is from the
iproute package, defined in (gnu packages linux).

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=44571

Hoping that it helps.

divoplade

[-- Attachment #2: static-ipv6.scm --]
[-- Type: text/x-scheme, Size: 1731 bytes --]

(define-module (gnu services static-ipv6)
  #:use-module (gnu services)
  #:use-module (gnu services shepherd)
  #:use-module (guix gexp)
  #:use-module (guix modules)
  #:use-module (guix records)
  #:use-module (gnu packages linux)
  #:use-module (ice-9 match)
  #:use-module (ice-9 optargs))

(define-record-type* <static-ipv6-configuration>
  static-ipv6-configuration
  make-static-ipv6-configuration
  static-ipv6-configuration?
  (iproute static-ipv6-configuration-iproute (default iproute))
  (address static-ipv6-configuration-address)
  (interface static-ipv6-configuration-interface))

(export <static-ipv6-configuration>
	static-ipv6-configuration
	make-static-ipv6-configuration
	static-ipv6-configuration?
	static-ipv6-configuration-iproute
	static-ipv6-configuration-address
	static-ipv6-configuration-interface)

(define static-ipv6-shepherd-service
  (match-lambda
    (($ <static-ipv6-configuration>
	iproute address interface)
     (list
      (shepherd-service
       (provision '(static-ipv6))
       (documentation (format #f "Add ~a/128 to interface ~a"
			      address interface))
       (requirement '(user-processes loopback syslogd))
       (start
	#~(lambda _
	    (system*
	     (string-append #$iproute "/sbin/ip")
	     "address"
	     "add"
	     "dev"
	     #$interface
	     (string-append #$address "/128"))))
       (stop
	#~(lambda _
	    (system*
	     (string-append #$iproute "/sbin/ip")
	     "address"
	     "delete"
	     "dev"
	     #$interface
	     (string-append #$address "/128")))))))))

(define-public static-ipv6-service-type
  (service-type (name 'static-ipv6)
		(extensions
		 (list
		  (service-extension
		   shepherd-root-service-type
		   static-ipv6-shepherd-service)))))

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

end of thread, other threads:[~2021-01-05 22:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 21:49 How can I have a static IP on one NIC and DHCP on the other? Katherine Cox-Buday
2021-01-05 22:08 ` divoplade

unofficial mirror of help-guix@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-user/0 guix-user/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 guix-user guix-user/ https://yhetil.org/guix-user \
		help-guix@gnu.org
	public-inbox-index guix-user

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.user
	nntp://news.gmane.io/gmane.comp.gnu.guix.user


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git