[PATCH 0/3] Fix and document NetworkManager + dnsmasq

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • pelzflorian (Florian Pelz)
Owner
unassigned
Submitted by
pelzflorian (Florian Pelz)
Severity
normal
P
P
pelzflorian (Florian Pelz) wrote on 19 Jun 2019 18:05
(address . guix-patches@gnu.org)
20190619160557.hkxkioufw2ybpgml@pelzflorian.localdomain
Please accept this patch series which enables and describes more use
cases of NetworkManager + Dnsmasq.

Regards,
Florian
F
F
Florian Pelz wrote on 19 Jun 2019 18:08
[PATCH 1/3] Use new upstream nomenclature in documentat ion of NetworkManager’s dnsmasq.
(address . 36294@debbugs.gnu.org)
20190619160836.cxjilufsrmhrfxqw@pelzflorian.localdomain
* doc/guix.texi (Networking Services): Replace term 'split DNS' by
'conditional forwarding'.
---
doc/guix.texi | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Toggle diff (17 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 65c3b8a7f1..694b802e1e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12735,8 +12735,8 @@ NetworkManager will update @code{resolv.conf} to reflect the nameservers
provided by currently active connections.
@item dnsmasq
-NetworkManager will run @code{dnsmasq} as a local caching nameserver,
-using a "split DNS" configuration if you are connected to a VPN, and
+NetworkManager will run @code{dnsmasq} as a local caching nameserver, using a
+@dfn{conditional forwarding} configuration if you are connected to a VPN, and
then update @code{resolv.conf} to point to the local nameserver.
@item none
--
2.22.0
F
F
Florian Pelz wrote on 19 Jun 2019 18:09
[PATCH 2/3] Have NetworkManager create '/var/lib/misc' directory required by dnsmasq.
(address . 36294@debbugs.gnu.org)
20190619160900.tduqs73f7jkz3lkn@pelzflorian.localdomain
* gnu/services/networking.scm (%network-manager-activation): Rename to...
(network-manager-activation): ... this and make it a procedure. Make it
create '/var/lib/misc' when using dnsmasq.
(network-manager-service-type): Use it.
---
gnu/services/networking.scm | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index 73acb3b17f..13cffd9feb 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -895,11 +895,17 @@ and @command{wicd-curses} user interfaces."
(vpn-plugins network-manager-vpn-plugins ;list of <package>
(default '())))
-(define %network-manager-activation
- ;; Activation gexp for NetworkManager.
- #~(begin
- (use-modules (guix build utils))
- (mkdir-p "/etc/NetworkManager/system-connections")))
+(define network-manager-activation
+ ;; Activation gexp for NetworkManager
+ (match-lambda
+ (($ <network-manager-configuration> network-manager dns vpn-plugins)
+ #~(begin
+ (use-modules (guix build utils))
+ (mkdir-p "/etc/NetworkManager/system-connections")
+ #$@(if (equal? dns "dnsmasq")
+ ;; create directory to store dnsmasq lease file
+ '((mkdir-p "/var/lib/misc"))
+ '())))))
(define (vpn-plugin-directory plugins)
"Return a directory containing PLUGINS, the NM VPN plugins."
@@ -949,7 +955,7 @@ and @command{wicd-curses} user interfaces."
(service-extension dbus-root-service-type config->package)
(service-extension polkit-service-type config->package)
(service-extension activation-service-type
- (const %network-manager-activation))
+ network-manager-activation)
(service-extension session-environment-service-type
network-manager-environment)
;; Add network-manager to the system profile.
--
2.22.0
F
F
Florian Pelz wrote on 19 Jun 2019 18:09
[PATCH 3/3] Document use cases for NetworkManager with dnsmasq.
(address . 36294@debbugs.gnu.org)
20190619160924.f6umtng4htysmqdi@pelzflorian.localdomain
* doc/guix.texi (Networking Services): Give examples.
---
doc/guix.texi | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)

Toggle diff (38 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 694b802e1e..172106068f 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -12739,6 +12739,31 @@ NetworkManager will run @code{dnsmasq} as a local caching nameserver, using a
@dfn{conditional forwarding} configuration if you are connected to a VPN, and
then update @code{resolv.conf} to point to the local nameserver.
+With this setting, you can share your network connection. For example when
+you want to share your network connection to another laptop @i{via} an
+Ethernet cable, you can open @command{nm-connection-editor} and configure the
+Wired connection’s method for IPv4 and IPv6 to be 'Shared to other computers'
+and reestablish the connection (or reboot).
+
+You can also set up a @dfn{host-to-guest connection} to QEMU VMs
+(@pxref{Installing Guix in a VM}). With a host-to-guest connection, you can
+e.g.@: access a Web server running on the VM (@pxref{Web Services}) from a Web
+browser on your host system, or connect to the VM @i{via} SSH
+(@pxref{Networking Services, @code{openssh-service-type}}). To set up a
+host-to-guest connection, run this command once:
+
+@example
+nmcli connection add type tun \
+ connection.interface-name tap0 \
+ tun.mode tap tun.owner $(id -u) \
+ ipv4.method shared \
+ ipv4.addresses 172.28.112.1/24
+@end example
+
+Then each time you launch your QEMU VM (@pxref{Running Guix in a VM}), pass
+@option{-nic tap,ifname=tap0,script=no,downscript=no} to
+@command{qemu-system-...}.
+
@item none
NetworkManager will not modify @code{resolv.conf}.
@end table
--
2.22.0
L
L
Ludovic Courtès wrote on 24 Jun 2019 23:26
(name . Florian Pelz)(address . pelzflorian@pelzflorian.de)(address . 36294-done@debbugs.gnu.org)
87zhm61xq7.fsf@gnu.org
Hi Florian,

Applied all 3 patches (I adjusted the subject line of each to have a
prefix as we usually do.)

Thank you!

Ludo’.
Closed
?