Codebase list ifupdown / 6cf6d0eb-4929-4da1-92c0-47f4ee3f3bce/main inet6.defn
6cf6d0eb-4929-4da1-92c0-47f4ee3f3bce/main

Tree @6cf6d0eb-4929-4da1-92c0-47f4ee3f3bce/main (Download .tar.gz)

inet6.defn @6cf6d0eb-4929-4da1-92c0-47f4ee3f3bce/mainraw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
address_family inet6
architecture linux

method auto
  description
    This method may be used to define interfaces with automatically assigned
    IPv6 addresses. Using this method on its own doesn't mean that RDNSS options
    will be applied, too. To make this happen, *rdnssd* daemon must be installed,
    properly configured and running.
    If stateless DHCPv6 support is turned on, then additional network
    configuration parameters such as DNS and NTP servers will be retrieved
    from a DHCP server. Please note that on ifdown, the lease is not currently
    released (a known bug).

  options
    privext int            -- Privacy extensions (RFC4941) (0=off, 1=assign, 2=prefer)
    accept_ra int          -- Accept router advertisements (0=off, 1=on, 2=on+forwarding) [2]
    dhcp int               -- Use stateless DHCPv6 (0=off, 1=on)
    request_prefix int     -- Request a prefix through DHCPv6 Prefix Delegation (0=off, 1=on) [0]
    ll-attempts            -- Number of attempts to wait for a link-local address [60]
    ll-interval            -- Link-local address polling interval in seconds [0.1]

  up
    /sbin/modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.use_tempaddr=%privext%]]
    -/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.accept_ra=%accept_ra%
    -/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.autoconf=1
    ip addr flush dev %iface% mngtmpaddr \
        if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd))
    ip link set dev %iface% up
    /lib/ifupdown/wait-for-ll6.sh if (var_true("dhcp", ifd) && execable("/lib/ifupdown/wait-for-ll6.sh"))
    /sbin/dhclient -6 -v -P -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (var_true("dhcp", ifd) && execable("/sbin/dhclient") && var_true("request_prefix", ifd))
    /sbin/dhclient -6 -1 -v -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        elsif (var_true("dhcp", ifd) && execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (var_true("dhcp", ifd))

  down
    ip -6 addr flush dev %iface% scope global
    ip link set dev %iface% down \
		if (iface_is_link())

method loopback
  description
    This method may be used to define the IPv6 loopback interface.
  up
    -ip link set dev %iface% up 2>/dev/null if (!iface_is_lo())
    -ip addr add dev %iface% ::1 2>/dev/null if (!iface_is_lo())
  down
    -ip addr del dev %iface% ::1 2>/dev/null if (!iface_is_lo())
    -ip link set dev %iface% down 2>/dev/null if (!iface_is_lo())

method static
  description
    This method may be used to define interfaces with statically assigned
    IPv6 addresses. By default, stateless autoconfiguration is disabled for
    this interface.

  options
    address address        -- Address (colon delimited/netmask) *required*
    netmask mask           -- Netmask (number of bits, eg 64) *deprecated*
    metric metric          -- Routing metric for default gateway (integer)
    gateway address        -- Default gateway (colon delimited)
    media type             -- Medium type, driver dependent
    hwaddress address      -- Hardware address or "random"
    mtu size               -- MTU size
    accept_ra int          -- Accept router advertisements (0=off, 1=on, 2=on+forwarding)
    autoconf int           -- Perform stateless autoconfiguration (0=off, 1=on) [0]
    privext int            -- Privacy extensions (RFC3041) (0=off, 1=assign, 2=prefer)
    scope                  -- Address validity scope. Possible values: \
                              global, site, link, host
    preferred-lifetime int -- Time that address remains preferred []
    dad-attempts           -- Number of attempts to settle DAD (0 to disable DAD) [60]
    dad-interval           -- DAD state polling interval in seconds [0.1]

  conversion
    hwaddress cleanup_hwaddress
    preferred-lifetime set_preferred_lft
    address (get_token / 1 "") =netmask?
    address (get_token / 0 "")
    gateway (if_set 0) =accept_ra?

  up
    /sbin/modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.use_tempaddr=%privext%]]
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.accept_ra=%accept_ra%]]
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.autoconf=%autoconf%]]
    -[[if [ "$(/bin/cat /sys/class/net/%iface%/mtu)" -lt %mtu% ]; then ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
    ip addr flush dev %iface% mngtmpaddr \
        if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd))
    ip link set dev %iface% [[address %hwaddress%]] up
    ip -6 addr add %address%[[/%netmask%]] [[scope %scope%]] dev %iface% [[preferred_lft %preferred-lifetime%]] \
                if (!var_set("dad-attempts", ifd) || var_true("dad-attempts", ifd))
    ip -6 addr add %address%[[/%netmask%]] [[scope %scope%]] dev %iface% [[preferred_lft %preferred-lifetime%]] nodad \
                if (var_set("dad-attempts", ifd) && !var_true("dad-attempts", ifd))
    [[ ip -6 route replace default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
    /lib/ifupdown/settle-dad.sh if (!no_act_commands && execable("/lib/ifupdown/settle-dad.sh") && (var_true("dad-attempts", ifd)))

  down
    [[ ip -6 route del default via %gateway% [[metric %metric%]] dev %iface% ]]
    ip -6 addr del %address%[[/%netmask%]] [[scope %scope%]] dev %iface%
    ip -6 addr flush dev %iface% \
    	if (iface_is_link())
    ip link set dev %iface% down \
		if (iface_is_link())

method manual
  description
    This method may be used to define interfaces for which no configuration
    is done by default.  Such interfaces can be configured manually by
    means of *up* and *down* commands or /etc/network/if-*.d scripts.

  options
    hwaddress address      -- Hardware address or "random"
    mtu size               -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    -[[if [ "$(/bin/cat /sys/class/net/%iface%/mtu)" -lt %mtu% ]; then ip link set dev %iface% mtu %mtu%; else /sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.mtu=%mtu%; fi]]
    [[ip link set dev %iface% address %hwaddress%]]
    ip link set dev %iface% up 2>/dev/null || true

  down
    ip -6 addr flush dev %iface% 2>/dev/null || true \
    	if (iface_is_link())
    ip link set dev %iface% down 2>/dev/null || true \
        if (iface_is_link() || !do_all)

method dhcp
  description
    This method may be used to obtain network interface configuration via
    stateful DHCPv6 with dhclient.  In stateful DHCPv6, the DHCP server is
    responsible for assigning addresses to clients.

  options
    hwaddress address      -- Hardware address or "random"
    accept_ra int          -- Accept router advertisements (0=off, 1=on, 2=on+forwarding) [1]
    autoconf int           -- Perform stateless autoconfiguration (0=off, 1=on)
    request_prefix int     -- Request a prefix through DHCPv6 Prefix Delegation (0=off, 1=on) [0]
    ll-attempts            -- Number of attempts to wait for a link-local address [60]
    ll-interval            -- Link-local address polling interval in seconds [0.1]

  conversion
    hwaddress cleanup_hwaddress

  up
    /sbin/modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.accept_ra=%accept_ra%]]
    -[[/sbin/sysctl -q -e -w net.ipv6.conf.%iface/.//%.autoconf=%autoconf%]]
    ip addr flush dev %iface% mngtmpaddr \
        if (var_set("accept_ra", ifd) && !var_true("accept_ra", ifd))
    ip link set dev %iface% [[address %hwaddress%]] up
    /lib/ifupdown/wait-for-ll6.sh if (execable("/lib/ifupdown/wait-for-ll6.sh"))
    /sbin/dhclient -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -P -N -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (execable("/sbin/dhclient") && var_true("request_prefix", ifd))
    /sbin/dhclient -6 -v -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        elsif (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

  down
    /sbin/dhclient -6 -v -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

    ip link set dev %iface% down \
		if (iface_is_link())

method v4tunnel
  description
    This method may be used to setup an IPv6-over-IPv4 tunnel. It requires
    the *ip* command from the *iproute* package.

  options
    address address       -- Address (colon delimited/netmask) *required*
    netmask mask          -- Netmask (number of bits, eg 64) *deprecated*
    endpoint address      -- Address of other tunnel endpoint (IPv4 \
                             dotted quad) *required*
    local address         -- Address of the local endpoint (IPv4 \
                             dotted quad)
    metric metric         -- Routing metric for default gateway (integer)
    gateway address       -- Default gateway (colon delimited)
    ttl time              -- TTL setting
    mtu size              -- MTU size
    preferred-lifetime int -- Time that address remains preferred []

  conversion
    preferred-lifetime set_preferred_lft

  up
    /sbin/modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
    ip tunnel add %iface% mode sit remote %endpoint% [[local %local%]] \
       [[ttl %ttl%]]
    ip link set %iface% up [[mtu %mtu%]]
    [[ ip addr add %address%[[/%netmask%]] dev %iface% [[preferred_lft %preferred-lifetime%]] ]]
    [[ ip route add %gateway% dev %iface% ]]
    [[ ip route add ::/0 via %gateway% [[metric %metric%]] dev %iface% onlink ]]

  down
    ip tunnel del %iface%

method 6to4
  description
    This method may be used to setup a 6to4 tunnel. It requires
    the *ip* command from the *iproute* package.

  options
    local address         -- Address of the local endpoint (IPv4 \
                             dotted quad) *required*
    metric metric         -- Routing metric for default gateway (integer)
    ttl time              -- TTL setting
    mtu size              -- MTU size
    preferred-lifetime int -- Time that address remains preferred []

  conversion
    local make_hex_address =hexaddress
    preferred-lifetime set_preferred_lft

  up
    /sbin/modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
    ip tunnel add %iface% mode sit remote any local %local% \
       [[ttl %ttl%]]
    ip link set %iface% up [[mtu %mtu%]]
    ip addr add 2002:%hexaddress%::1/16 dev %iface% [[preferred_lft %preferred-lifetime%]]
    ip route add 2000::/3 via ::192.88.99.1 [[metric %metric%]] dev %iface%

  down
    ip -6 route flush dev %iface%
    ip link set dev %iface% down
    ip tunnel del %iface%


architecture kfreebsd

method loopback
  description
    This method may be used to define the IPv6 loopback interface.
  up
    /sbin/ifconfig %iface% inet6 ::1 \
	if (!iface_is_lo())
  down
    /sbin/ifconfig %iface% down \
	if (!iface_is_lo())

method static
  description
    This method may be used to define interfaces with statically assigned
    IPv6 addresses.

  options
    address address        -- Address (colon delimited/netmask) *required*
    netmask mask           -- Netmask (number of bits, eg 64) *deprecated*
    gateway address        -- Default gateway (colon delimited)
    media type             -- Medium type, driver dependent
    hwaddress address      -- Hardware address or "random"
    mtu size               -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    /sbin/ifconfig %iface% [[media %media%]] [[link %hwaddress%]] [[mtu %mtu%]] up
    /sbin/ifconfig %iface% inet6 %address%[[/%netmask%]] alias
    [[ /sbin/route add -inet6 ::/0 %gateway% ]]

  down
    [[ /sbin/route -n del -inet6 ::/0 2>&1 1>/dev/null || true ]]
    [[ /sbin/ifconfig %iface% inet6 %address% -alias ]]
    /sbin/ifconfig %iface% down

method manual
  description
    This method may be used to define interfaces for which no configuration
    is done by default.  Such interfaces can be configured manually by
    means of *up* and *down* commands or /etc/network/if-*.d scripts.

  up

  down

method auto
  description
    This method may be used to define interfaces with automatically assigned
    IPv6 addresses. Using this method on its own doesn't mean that RDNSS options
    will be applied, too. To make this happen, *rdnssd* daemon must be installed,
    properly configured and running.
    If stateless DHCPv6 support is turned on, then additional network
    configuration parameters such as DNS and NTP servers will be retrieved
    from a DHCP server. Please note that on ifdown, the lease is not currently
    released (a known bug).

  options
    dhcp int               -- Use stateless DHCPv6 (0=off, 1=on)

  conversion
    hwaddress cleanup_hwaddress

  up
    /sbin/ifconfig %iface% inet6 accept_rtadv up
    /sbin/dhclient -6 -S -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (var_true("dhcp", ifd) && execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (var_true("dhcp", ifd))

  down
    /sbin/ifconfig %iface% down



method dhcp
  description
    This method may be used to obtain network interface configuration via
    stateful DHCPv6 with dhclient.  In stateful DHCPv6, the DHCP server is
    responsible for assigning addresses to clients.

  options
    hwaddress address      -- Hardware address or "random"

  conversion
    hwaddress cleanup_hwaddress

  up
    /sbin/ifconfig %iface% [[link %hwaddress%]] up
    /sbin/dhclient -6 -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

  down
    /sbin/dhclient -6 -r -pf /run/dhclient6.%iface%.pid -lf /var/lib/dhcp/dhclient6.%iface%.leases -I -df /var/lib/dhcp/dhclient.%iface%.leases %iface% \
        if (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

    /sbin/ifconfig %iface% down

architecture hurd

method loopback
  description
    This method may be used to define the IPv6 loopback interface.
  up
    [[FIXME: Add proper commands here for ipv6]]
  down
    [[FIXME: Add proper commands here for ipv6]]

method static
  description
    This method may be used to define interfaces with statically assigned
    IPv6 addresses.

  options
    address address        -- Address (colon delimited/netmask) *required*
    netmask mask           -- Netmask (number of bits, eg 64) *deprecated*
    gateway address        -- Default gateway (colon delimited)
    media type             -- Medium type, driver dependent
    hwaddress address      -- Hardware address  (Not yet supported)
    mtu size               -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    [[FIXME: Add proper commands here for ipv6]]
    [[Warning: Option media: %media% not yet supported]]
    [[Warning: Option hwaddress: %hwaddress% not yet supported]]

  down
    [[FIXME: Add proper commands here for ipv6]]

method manual
  description
    This method may be used to define interfaces for which no configuration
    is done by default.  Such interfaces can be configured manually by
    means of *up* and *down* commands or /etc/network/if-*.d scripts.

  up

  down

method dhcp
  description
    This method may be used to obtain network interface configuration via
    stateful DHCPv6 with dhclient.  In stateful DHCPv6, the DHCP server is
    responsible for assigning addresses to clients.

  options
    hwaddress address      -- Hardware address (Not yet supported)

  conversion
    hwaddress cleanup_hwaddress

  up
    [[Warning: Option hwaddress: %hwaddress% not yet supported]]
    inetutils-ifconfig --interface %iface% --up
    /sbin/dhclient -6 -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \
        if (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

  down
    /sbin/dhclient -6 -r -pf /run/dhclient6.%iface///.%.pid -lf /var/lib/dhcp/dhclient6.%iface///.%.leases -I -df /var/lib/dhcp/dhclient.%iface///.%.leases %iface% \
        if (execable("/sbin/dhclient"))
    echo 'No DHCPv6 client software found!' >&2; false \
        elsif (1)

    inetutils-ifconfig --interface %iface% --down