unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Adding a network interface
@ 2017-09-24 17:12 Konrad Hinsen
  2017-09-25 14:39 ` Ricardo Wurmus
  0 siblings, 1 reply; 3+ messages in thread
From: Konrad Hinsen @ 2017-09-24 17:12 UTC (permalink / raw)
  To: guix-devel

Dear Guixers,

I have started to play with GuixSD in a virtual machine, but I quickly 
got stuck. My starting point is the supplied "bare bones" setup, which 
works fine with only trivial modifications such as the disk device name 
and the user accounts to be created.

My virtual machine has two network interfaces, one for connections to 
the outside world and one for connections to/from the host (that's how 
VirtualBox works). The first one gets configured automatically via DHCP, 
presumably via (dhcp-client-service). The second one must be configured 
statically. After some exploration, I added

   (static-networking-service "enp0s8" ...)

to the list of services. No chance:

   service "networking" provided more than once

That must be because "lo" is already configured in %base-services. But 
the documentation explicitly says that I can call 
static-networking-service multiple times for multiple interfaces!

After a look at the source code for service management, I tried

   (modify-services %base-services
      (static-networking-service-type
         interfaces => (cons (static-networking-service "enp0s8" ...)
                             interfaces)))

This yields an error message from static-networking-shepherd-service 
about concerning "no matching pattern", which suggests that I haven't 
read enough of the source code to get this right. Back to the source 
code, and another try:

   (modify-services %base-services
      (static-networking-service-type
         interfaces => (cons (static-networking (interface "enp0s8") ...)
                             interfaces)))

Now I am back to: service "networking" provided more than once. So I am 
giving up... What's the solution to this puzzle?

Konrad.

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

* Re: Adding a network interface
  2017-09-24 17:12 Adding a network interface Konrad Hinsen
@ 2017-09-25 14:39 ` Ricardo Wurmus
  2017-09-26  7:02   ` Konrad Hinsen
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2017-09-25 14:39 UTC (permalink / raw)
  To: Konrad Hinsen; +Cc: guix-devel


Hi Konrad,

> My virtual machine has two network interfaces, one for connections to 
> the outside world and one for connections to/from the host (that's how 
> VirtualBox works). The first one gets configured automatically via DHCP, 
> presumably via (dhcp-client-service). The second one must be configured 
> statically. After some exploration, I added
>
>    (static-networking-service "enp0s8" ...)
>
> to the list of services. No chance:
>
>    service "networking" provided more than once
>
> That must be because "lo" is already configured in %base-services. But 
> the documentation explicitly says that I can call 
> static-networking-service multiple times for multiple interfaces!

This works for me.  I have configured berlin.guixsd.org with two network
interfaces by simply providing static-networking-service twice.  I’m not
removing any services from %base-services:

  (services (cons* …
             (static-networking-service "enp6s4f0"
                                        "141.80.181.40"
                                        #:netmask "255.255.255.0"
                                        #:gateway "141.80.181.1")
             (static-networking-service "enp0s8"
                                        "192.168.0.1"
                                        #:netmask "255.255.255.0")
             …
             %base-services))

-- 
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
https://elephly.net

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

* Re: Adding a network interface
  2017-09-25 14:39 ` Ricardo Wurmus
@ 2017-09-26  7:02   ` Konrad Hinsen
  0 siblings, 0 replies; 3+ messages in thread
From: Konrad Hinsen @ 2017-09-26  7:02 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi Ricardo,

Thanks for your reply!

> This works for me.  I have configured berlin.guixsd.org with two network
> interfaces by simply providing static-networking-service twice.  I’m not
> removing any services from %base-services:
>
>   (services (cons* …
>              (static-networking-service "enp6s4f0"
>                                         "141.80.181.40"
>                                         #:netmask "255.255.255.0"
>                                         #:gateway "141.80.181.1")

OK, so my first try was right but my interpretation of the error message
wasn't. After some further exploration, the already-running network
service is indeed not the statically configured loopback, but
(dhcp-client-service), which handles all network adapters other than
loopback.

Configuring both of my adapters with static IPs works very well, but
is not practical for a laptop used in different networks. Back to
rethinking my deployment strategy...

Konrad.

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

end of thread, other threads:[~2017-09-26  7:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-24 17:12 Adding a network interface Konrad Hinsen
2017-09-25 14:39 ` Ricardo Wurmus
2017-09-26  7:02   ` Konrad Hinsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).