Debian Codegraph @

upstream/debian-unstable/man8/nss-mymachines.8

raw
1 '\" t
2 .TH "NSS\-MYMACHINES" "8" "" "systemd 261~rc3" "nss-mymachines"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 nss-mymachines, libnss_mymachines.so.2 \- Hostname resolution for local container instances
24 .SH "SYNOPSIS"
25 .PP
26 libnss_mymachines\&.so\&.2
27 .SH "DESCRIPTION"
28 .PP
29 \fBnss\-mymachines\fR
30 is a plug\-in module for the GNU Name Service Switch (NSS) functionality of the GNU C Library (\fBglibc\fR), providing hostname resolution for the names of containers running locally that are registered with
31 \fBsystemd-machined.service\fR(8)\&. The container names are resolved to the IP addresses of the specific container, ordered by their scope\&. This functionality only applies to containers using network namespacing (see the description of
32 \fB\-\-private\-network\fR
33 in
34 \fBsystemd-nspawn\fR(1))\&. Note that the name that is resolved is the one registered with
35 \fBsystemd\-machined\fR, which may be different than the hostname configured inside of the container\&.
36 .PP
37 Note that this NSS module only makes available names of the containers running immediately below the current system context\&. It does not provide host name resolution for containers running side\-by\-side with the invoking system context, or containers further up or down the container hierarchy\&. Or in other words, on the host system it provides host name resolution for the containers running immediately below the host environment\&. When used inside a container environment however, it will not be able to provide name resolution for containers running on the host (as those are siblings and not children of the current container environment), but instead only for nested containers running immediately below its own container environment\&.
38 .PP
39 To activate the NSS module, add
40 "mymachines"
41 to the line starting with
42 "hosts:"
43 in
44 /etc/nsswitch\&.conf\&.
45 .PP
46 It is recommended to place
47 "mymachines"
48 before the
49 "resolve"
50 or
51 "dns"
52 entry of the
53 "hosts:"
54 line of
55 /etc/nsswitch\&.conf
56 in order to make sure that its mappings are preferred over other resolvers such as DNS\&.
57 .SH "CONFIGURATION IN /ETC/NSSWITCH\&.CONF"
58 .PP
59 Here is an example
60 /etc/nsswitch\&.conf
61 file that enables
62 \fBnss\-mymachines\fR
63 correctly:
64 .sp
65 .if n \{\
66 .RS 4
67 .\}
68 .nf
69 passwd: files systemd
70 group: files [SUCCESS=merge] systemd
71 shadow: files systemd
72 gshadow: files systemd
73
74 hosts: \fBmymachines\fR resolve [!UNAVAIL=return] files myhostname dns
75 networks: files
76
77 protocols: db files
78 services: db files
79 ethers: db files
80 rpc: db files
81
82 netgroup: nis
83 .fi
84 .if n \{\
85 .RE
86 .\}
87 .SH "EXAMPLE: MAPPINGS PROVIDED BY NSS\-MYMACHINES"
88 .PP
89 The container
90 "rawhide"
91 is spawned using
92 \fBsystemd-nspawn\fR(1):
93 .sp
94 .if n \{\
95 .RS 4
96 .\}
97 .nf
98 # systemd\-nspawn \-M rawhide \-\-boot \-\-network\-veth \-\-private\-users=pick
99 Spawning container rawhide on /var/lib/machines/rawhide\&.
100 Selected user namespace base 20119552 and range 65536\&.
101 \&.\&.\&.
102
103 $ machinectl \-\-max\-addresses=3
104 MACHINE CLASS SERVICE OS VERSION ADDRESSES
105 rawhide container systemd\-nspawn fedora 30 169\&.254\&.40\&.164 fe80::94aa:3aff:fe7b:d4b9
106
107 $ ping \-c1 rawhide
108 PING rawhide(fe80::94aa:3aff:fe7b:d4b9%ve\-rawhide (fe80::94aa:3aff:fe7b:d4b9%ve\-rawhide)) 56 data bytes
109 64 bytes from fe80::94aa:3aff:fe7b:d4b9%ve\-rawhide (fe80::94aa:3aff:fe7b:d4b9%ve\-rawhide): icmp_seq=1 ttl=64 time=0\&.045 ms
110 \&.\&.\&.
111 $ ping \-c1 \-4 rawhide
112 PING rawhide (169\&.254\&.40\&.164) 56(84) bytes of data\&.
113 64 bytes from 169\&.254\&.40\&.164 (169\&.254\&.40\&.164): icmp_seq=1 ttl=64 time=0\&.064 ms
114 \&.\&.\&.
115
116 # machinectl shell rawhide /sbin/ip a
117 Connected to machine rawhide\&. Press ^] three times within 1s to exit session\&.
118 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
119 \&.\&.\&.
120 2: host0@if21: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
121 link/ether 96:aa:3a:7b:d4:b9 brd ff:ff:ff:ff:ff:ff link\-netnsid 0
122 inet 169\&.254\&.40\&.164/16 brd 169\&.254\&.255\&.255 scope link host0
123 valid_lft forever preferred_lft forever
124 inet6 fe80::94aa:3aff:fe7b:d4b9/64 scope link
125 valid_lft forever preferred_lft forever
126 Connection to machine rawhide terminated\&.
127 .fi
128 .if n \{\
129 .RE
130 .\}
131 .SH "SEE ALSO"
132 .PP
133 \fBsystemd\fR(1), \fBsystemd-machined.service\fR(8), \fBmachinectl\fR(1), \fBnss-systemd\fR(8), \fBnss-resolve\fR(8), \fBnss-myhostname\fR(8), \fBnsswitch.conf\fR(5), \fBgetent\fR(1)