unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* how can I add a static IPv4 route?
@ 2020-02-12 18:08 Giovanni Biscuolo
  2020-02-12 18:34 ` Julien Lepiller
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Biscuolo @ 2020-02-12 18:08 UTC (permalink / raw)
  To: help-guix

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

Hello,

I have a very simple networking configuration:

--8<---------------cut here---------------start------------->8---
(service dhcp-client-service-type)
--8<---------------cut here---------------end--------------->8---

Please how can I add a static route? (I know there is wip-netlink, but
AFAIU it's still not in master)

I found a message from Julien [1] explaining he is using a custom
service [2] to define both IPv4 and IPv6 for the same device: do I have
to adapt that?

Since my guile-fu is very minimal, please do you have a snippet I can
reuse apart Julien's above?

Thanks! Gio'

[1] Message-ID: <80602DD8-60A9-487D-B39C-46360F42C0D2@lepiller.eu>

[2] https://framagit.org/tyreunom/system-configuration/blob/master/modules/config/network.scm

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: how can I add a static IPv4 route?
  2020-02-12 18:08 how can I add a static IPv4 route? Giovanni Biscuolo
@ 2020-02-12 18:34 ` Julien Lepiller
  2020-02-13  8:22   ` Giovanni Biscuolo
  0 siblings, 1 reply; 5+ messages in thread
From: Julien Lepiller @ 2020-02-12 18:34 UTC (permalink / raw)
  To: help-guix, Giovanni Biscuolo

Le 12 février 2020 13:08:46 GMT-05:00, Giovanni Biscuolo <g@xelera.eu> a écrit :
>Hello,
>
>I have a very simple networking configuration:
>
>--8<---------------cut here---------------start------------->8---
>(service dhcp-client-service-type)
>--8<---------------cut here---------------end--------------->8---
>
>Please how can I add a static route? (I know there is wip-netlink, but
>AFAIU it's still not in master)
>
>I found a message from Julien [1] explaining he is using a custom
>service [2] to define both IPv4 and IPv6 for the same device: do I have
>to adapt that?
>
>Since my guile-fu is very minimal, please do you have a snippet I can
>reuse apart Julien's above?
>
>Thanks! Gio'
>
>[1] Message-ID: <80602DD8-60A9-487D-B39C-46360F42C0D2@lepiller.eu>
>
>[2]
>https://framagit.org/tyreunom/system-configuration/blob/master/modules/config/network.scm

Hi,

I only use this custom service because guix doesn't provide static networking for IPv6. However, if you don't need IPv6, I'd like to encourage you to use the static-networking-service that's described in the manual: https://guix.gnu.org/manual/devel/en/html_node/Networking-Services.html#Networking-Services

Otherwise, feel free to copy and adapt my stuff :)

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

* Re: how can I add a static IPv4 route?
  2020-02-12 18:34 ` Julien Lepiller
@ 2020-02-13  8:22   ` Giovanni Biscuolo
  2020-02-13  8:42     ` Efraim Flashner
  0 siblings, 1 reply; 5+ messages in thread
From: Giovanni Biscuolo @ 2020-02-13  8:22 UTC (permalink / raw)
  To: Julien Lepiller, help-guix

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

Hi Julien

thanks for your support!

Julien Lepiller <julien@lepiller.eu> writes:

> Le 12 février 2020 13:08:46 GMT-05:00, Giovanni Biscuolo <g@xelera.eu> a écrit :
>>Hello,
>>
>>I have a very simple networking configuration:
>>
>>--8<---------------cut here---------------start------------->8---
>>(service dhcp-client-service-type)
>>--8<---------------cut here---------------end--------------->8---
>>
>>Please how can I add a static route? (I know there is wip-netlink, but
>>AFAIU it's still not in master)

[...]

> However, if you don't need IPv6, I'd like to encourage you to use the
> static-networking-service that's described in the manual:
> https://guix.gnu.org/manual/devel/en/html_node/Networking-Services.html#Networking-Services

Thanks for your suggestion but I don't understand how to use it just to
add a static route to the interface set up by dhcp-client-service-type.

I'm trying to have something similar to this debian interfaces config:

--8<---------------cut here---------------start------------->8---
auto eth0
iface eth0 inet dhcp
	### static routing for eth0 ###
        post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65
        pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65
--8<---------------cut here---------------end--------------->8---

I'd like to stay whith a dhcp client config, but please provide an
example on how to add a static route to a configuration like this:

--8<---------------cut here---------------start------------->8---
(static-networking-service "eno1" "192.168.1.82"
                           #:gateway "192.168.1.2"
                           #:name-servers '("192.168.1.2"))
--8<---------------cut here---------------end--------------->8---

Thanks! Gio'

-- 
Giovanni Biscuolo

Xelera IT Infrastructures

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

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

* Re: how can I add a static IPv4 route?
  2020-02-13  8:22   ` Giovanni Biscuolo
@ 2020-02-13  8:42     ` Efraim Flashner
  2020-02-13 12:12       ` Julien Lepiller
  0 siblings, 1 reply; 5+ messages in thread
From: Efraim Flashner @ 2020-02-13  8:42 UTC (permalink / raw)
  To: Giovanni Biscuolo; +Cc: help-guix

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

On Thu, Feb 13, 2020 at 09:22:46AM +0100, Giovanni Biscuolo wrote:
> Hi Julien
> 
> thanks for your support!
> 
> Julien Lepiller <julien@lepiller.eu> writes:
> 
> > Le 12 février 2020 13:08:46 GMT-05:00, Giovanni Biscuolo <g@xelera.eu> a écrit :
> >>Hello,
> >>
> >>I have a very simple networking configuration:
> >>
> >>--8<---------------cut here---------------start------------->8---
> >>(service dhcp-client-service-type)
> >>--8<---------------cut here---------------end--------------->8---
> >>
> >>Please how can I add a static route? (I know there is wip-netlink, but
> >>AFAIU it's still not in master)
> 
> [...]
> 
> > However, if you don't need IPv6, I'd like to encourage you to use the
> > static-networking-service that's described in the manual:
> > https://guix.gnu.org/manual/devel/en/html_node/Networking-Services.html#Networking-Services
> 
> Thanks for your suggestion but I don't understand how to use it just to
> add a static route to the interface set up by dhcp-client-service-type.
> 
> I'm trying to have something similar to this debian interfaces config:
> 
> --8<---------------cut here---------------start------------->8---
> auto eth0
> iface eth0 inet dhcp
> 	### static routing for eth0 ###
>         post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65
>         pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.9.38.65
> --8<---------------cut here---------------end--------------->8---
> 
> I'd like to stay whith a dhcp client config, but please provide an
> example on how to add a static route to a configuration like this:
> 
> --8<---------------cut here---------------start------------->8---
> (static-networking-service "eno1" "192.168.1.82"
>                            #:gateway "192.168.1.2"
>                            #:name-servers '("192.168.1.2"))
> --8<---------------cut here---------------end--------------->8---
> 

I'm going to take a shot at this. There's another example in the
guix-maintenance repo for berlin and some other machines

             ;; Connection to the DMZ for public access
             ;; This is a 1G port only
             (static-networking-service "eno1"
                                        "141.80.181.41"
                                        #:netmask "255.255.255.0"
                                        #:gateway "141.80.181.1")
             ;; This is a 10G port.
             (static-networking-service "enp129s0f0"
                                        "141.80.181.40"
                                        #:netmask "255.255.255.0")
             ;; Connection to build nodes
             (static-networking-service "eno3"
                                        "141.80.167.131"
                                        #:netmask "255.255.255.192")


So for what you've posted I would guess the following:
(It doesn't look like the static-networking-service allows you to use
DHCP to receive an IP address)

(static-networking-service "eth0"
                           "10.x.y.z"
                           #:netmask "255.0.0.0"
                           #:gateway "10.9.38.65")



-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: how can I add a static IPv4 route?
  2020-02-13  8:42     ` Efraim Flashner
@ 2020-02-13 12:12       ` Julien Lepiller
  0 siblings, 0 replies; 5+ messages in thread
From: Julien Lepiller @ 2020-02-13 12:12 UTC (permalink / raw)
  To: Efraim Flashner, Giovanni Biscuolo; +Cc: help-guix

Le 13 février 2020 03:42:46 GMT-05:00, Efraim Flashner <efraim@flashner.co.il> a écrit :
>On Thu, Feb 13, 2020 at 09:22:46AM +0100, Giovanni Biscuolo wrote:
>> Hi Julien
>> 
>> thanks for your support!
>> 
>> Julien Lepiller <julien@lepiller.eu> writes:
>> 
>> > Le 12 février 2020 13:08:46 GMT-05:00, Giovanni Biscuolo
><g@xelera.eu> a écrit :
>> >>Hello,
>> >>
>> >>I have a very simple networking configuration:
>> >>
>> >>--8<---------------cut here---------------start------------->8---
>> >>(service dhcp-client-service-type)
>> >>--8<---------------cut here---------------end--------------->8---
>> >>
>> >>Please how can I add a static route? (I know there is wip-netlink,
>but
>> >>AFAIU it's still not in master)
>> 
>> [...]
>> 
>> > However, if you don't need IPv6, I'd like to encourage you to use
>the
>> > static-networking-service that's described in the manual:
>> >
>https://guix.gnu.org/manual/devel/en/html_node/Networking-Services.html#Networking-Services
>> 
>> Thanks for your suggestion but I don't understand how to use it just
>to
>> add a static route to the interface set up by
>dhcp-client-service-type.
>> 
>> I'm trying to have something similar to this debian interfaces
>config:
>> 
>> --8<---------------cut here---------------start------------->8---
>> auto eth0
>> iface eth0 inet dhcp
>> 	### static routing for eth0 ###
>>         post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw
>10.9.38.65
>>         pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw
>10.9.38.65
>> --8<---------------cut here---------------end--------------->8---
>> 
>> I'd like to stay whith a dhcp client config, but please provide an
>> example on how to add a static route to a configuration like this:
>> 
>> --8<---------------cut here---------------start------------->8---
>> (static-networking-service "eno1" "192.168.1.82"
>>                            #:gateway "192.168.1.2"
>>                            #:name-servers '("192.168.1.2"))
>> --8<---------------cut here---------------end--------------->8---
>> 
>
>I'm going to take a shot at this. There's another example in the
>guix-maintenance repo for berlin and some other machines
>
>             ;; Connection to the DMZ for public access
>             ;; This is a 1G port only
>             (static-networking-service "eno1"
>                                        "141.80.181.41"
>                                        #:netmask "255.255.255.0"
>                                        #:gateway "141.80.181.1")
>             ;; This is a 10G port.
>             (static-networking-service "enp129s0f0"
>                                        "141.80.181.40"
>                                        #:netmask "255.255.255.0")
>             ;; Connection to build nodes
>             (static-networking-service "eno3"
>                                        "141.80.167.131"
>                                        #:netmask "255.255.255.192")
>
>
>So for what you've posted I would guess the following:
>(It doesn't look like the static-networking-service allows you to use
>DHCP to receive an IP address)
>
>(static-networking-service "eth0"
>                           "10.x.y.z"
>                           #:netmask "255.0.0.0"
>                           #:gateway "10.9.38.65")

Ah you're right, I didn't understand. You'll need a new service that runs after the dhcp service and adds the route, with iproute2 for instance.

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

end of thread, other threads:[~2020-02-13 16:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-12 18:08 how can I add a static IPv4 route? Giovanni Biscuolo
2020-02-12 18:34 ` Julien Lepiller
2020-02-13  8:22   ` Giovanni Biscuolo
2020-02-13  8:42     ` Efraim Flashner
2020-02-13 12:12       ` Julien Lepiller

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).