File: inet.defn

package info (click to toggle)
ifupdown 0.8.44
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 952 kB
  • sloc: ansic: 2,781; sh: 899; perl: 513; makefile: 90
file content (511 lines) | stat: -rw-r--r-- 19,044 bytes parent folder | download | duplicates (4)
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
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
address_family inet
architecture linux

method loopback
  description
    This method may be used to define the IPv4 loopback interface.

  up
    ip link set dev %iface% up if (!iface_is_lo())

  down
    ip link set dev %iface% down if (!iface_is_lo())

method static
  description
    This method may be used to define Ethernet interfaces with statically
    allocated IPv4 addresses.
      
  options
    address address             -- Address (dotted quad/netmask) *required*
    netmask mask                -- Netmask (dotted quad or number of bits) *deprecated*
    broadcast broadcast_address -- Broadcast address (dotted quad, + or -) *deprecated* [+]
    metric metric               -- Routing metric for default gateway (integer)
    gateway address             -- Default gateway (dotted quad)
    pointopoint address         -- Address of other end point (dotted quad). \
                                   Note the spelling of "point-to".
    hwaddress address           -- Link local address or "random".
    mtu size                    -- MTU size
    scope                       -- Address validity scope. Possible values: \
                                   global, link, host

  conversion
    hwaddress cleanup_hwaddress
    address compute_v4_mask =netmask?
    address compute_v4_addr
    broadcast compute_v4_broadcast

  up
    ip addr add %address%[[/%netmask%]] [[broadcast %broadcast%]] \
	[[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
    ip link set dev %iface% [[mtu %mtu%]] [[address %hwaddress%]] up

    [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]

  down
    [[ ip route del default via %gateway% [[metric %metric%]] dev %iface% 2>&1 1>/dev/null || true ]]
    ip addr del %address%[[/%netmask%]] [[broadcast %broadcast%]] \
	[[peer %pointopoint%]] [[scope %scope%]] dev %iface% label %iface%
    ip -4 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           -- Link local address or "random".
    mtu size                    -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    [[ip link set dev %iface% mtu %mtu%]]
    [[ip link set dev %iface% address %hwaddress%]]
    ip link set dev %iface% up 2>/dev/null || true

  down
    ip -4 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 an address via DHCP with any of
    the tools: dhclient, udhcpc, dhcpcd.
    (They have been listed in their order of precedence.)
    If you have a complicated DHCP setup you should
    note that some of these clients use their own configuration files
    and do not obtain their configuration information via *ifup*.

  options
    hostname hostname       -- Hostname to be requested (dhcpcd, udhcpc)
    metric metric           -- Metric for added routes (dhclient)
    leasetime leasetime     -- Preferred lease time in seconds (dhcpcd)
    vendor vendor_id        -- Vendor class identifier (dhcpcd)
    client client_id        -- Client identifier (dhcpcd), or "no" (dhclient)
    hwaddress address       -- Hardware address.

  conversion
    hwaddress cleanup_hwaddress

  up
    [[ip link set dev %iface% address %hwaddress%]]
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
	[[-e IF_METRIC=%metric%]] \
        if (execable("dhclient"))
    udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-x hostname:%hostname%]] \
        elsif (execable("udhcpc"))
    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
           [[-l %leasetime%]] [[-m %metric%]] %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

  down
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
        if (execable("dhclient"))
    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
        elsif (execable("udhcpc"))
    dhcpcd -k %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

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

method bootp
  description
    This method may be used to obtain an address via bootp.

  options
    bootfile file  -- Tell the server to use /file/ as the bootfile.
    server address -- Use the IP address /address/ to communicate with \
                      the server.
    hwaddr addr    -- Use /addr/ as the hardware address instead of \
                      whatever it really is.

  up
    bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
           [[--hwaddr %hwaddr%]] --returniffail --serverbcast

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

method tunnel
  description
    This method is used to create GRE or IPIP tunnels. You need to have
    the *ip* binary from the *iproute* package. For GRE tunnels, you
    will need to load the ip_gre module and the ipip module for
    IPIP tunnels.
  options
    address address       -- Local address (dotted quad) *required*
    mode type             -- Tunnel type (either GRE or IPIP) *required*
    endpoint address      -- Address of other tunnel endpoint *required*
    dstaddr address       -- Remote address (remote address inside tunnel)
    local address         -- Address of the local endpoint
    metric metric         -- Routing metric for default gateway (integer)
    gateway address       -- Default gateway
    ttl time              -- TTL setting
    mtu size              -- MTU size
  up
    ip tunnel add %iface% mode %mode% remote %endpoint% [[local %local%]] \
       [[ttl %ttl%]]
    ip link set %iface% up [[mtu %mtu%]]
    ip addr add %address%/%netmask% dev %iface% [[peer %dstaddr%]]
    [[ ip route add default via %gateway% [[metric %metric%]] dev %iface% onlink ]]
  down
    ip tunnel del %iface%

method ppp
  description
    This method uses pon/poff to configure a PPP interface. See those
    commands for details.
  options
    provider name  -- Use /name/ as the provider (from /etc/ppp/peers).
    unit number    -- Use /number/ as the ppp unit number.
    options string -- Pass /string/ as additional options to pon.
  up
    pon [[%provider%]] [[unit %unit%]] [[%options%]]
  down
    poff [[%provider%]]

method wvdial
  description
    This method uses wvdial to configure a PPP interface. See that command
    for more details.
  options
    provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
  up
    start-stop-daemon --start -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
  down
    start-stop-daemon --stop -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface%.pid -s 2


method ipv4ll
  description
    This method uses avahi-autoipd to configure an interface with an
    IPv4 Link-Layer address (169.254.0.0/16 family). This method is also
    known as APIPA or IPAC, and often colloquially referred to
    as "Zeroconf address".
  up
    avahi-autoipd -D %iface%
  down
    avahi-autoipd --kill %iface%

architecture kfreebsd

method loopback
  description
    This method may be used to define the IPv4 loopback interface.

  up
    ifconfig %iface% 127.0.0.1 up \
	if (!iface_is_lo())

  down
    ifconfig %iface% down \
	if (!iface_is_lo())

method static
  description
    This method may be used to define Ethernet interfaces with statically
    allocated IPv4 addresses.
      
  options
    address address             -- Address (dotted quad/netmask) *required*
    netmask mask                -- Netmask (dotted quad or number of bits) *deprecated*
    broadcast broadcast_address -- Broadcast address (dotted quad) *deprecated*
    metric metric               -- Routing metric for default gateway (integer)
    gateway address             -- Default gateway (dotted quad)
    pointopoint address         -- Address of other end point (dotted quad). \
                                   Note the spelling of "point-to".
    hwaddress address           -- Link local address or "random".
    mtu size                    -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    [[ ifconfig %iface% link %hwaddress%]]
    ifconfig %iface% %address% [[netmask %netmask%]] [[broadcast %broadcast%]] \
	[[pointopoint %pointopoint%]] [[media %media%]] [[mtu %mtu%]] \
	up
    [[ route add default %gateway% ]]

  down
    [[ route del default %gateway% 2>&1 1>/dev/null || true ]]
    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 dhcp
  description
    This method may be used to obtain an address via DHCP with any of
    the tools: dhclient, udhcpc, dhcpcd.
    (They have been listed in their order of precedence.)
    If you have a complicated DHCP setup you should
    note that some of these clients use their own configuration files
    and do not obtain their configuration information via *ifup*.

  options
    hostname hostname       -- Hostname to be requested (dhcpcd, udhcpc)
    metric metric           -- Metric for added routes (dhclient)
    leasetime leasetime     -- Preferred lease time in seconds (dhcpcd)
    vendor vendor_id        -- Vendor class identifier (dhcpcd)
    client client_id        -- Client identifier (dhcpcd, udhcpc) or "no" (dhclient)
    hwaddress address       -- Hardware Address.

  conversion
    hwaddress cleanup_hwaddress

  up
    [[ifconfig %iface% link %hwaddress%]]
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
	[[-e IF_METRIC=%metric%]] \
        if (execable("dhclient"))
    udhcpc -n -p /run/udhcpc.%iface%.pid -i %iface% [[-H %hostname%]] \
           [[-c %client%]] \
        elsif (execable("udhcpc"))
    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
           [[-l %leasetime%]] %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

  down
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -r -pf /run/dhclient.%iface%.pid -lf /var/lib/dhcp/dhclient.%iface%.leases -I -df /var/lib/dhcp/dhclient6.%iface%.leases %iface% \
        if (execable("dhclient"))
    if test -f /run/udhcpc.%iface%.pid; then kill -USR2 $(cat /run/udhcpc.%iface%.pid); kill -TERM $(cat /run/udhcpc.%iface%.pid); fi \
        elsif (execable("udhcpc"))
    dhcpcd -k %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

    ifconfig %iface% down

method bootp
  description
    This method may be used to obtain an address via bootp.

  options
    bootfile file  -- Tell the server to use /file/ as the bootfile.
    server address -- Use the IP address /address/ to communicate with \
                      the server.
    hwaddr addr    -- Use /addr/ as the hardware address instead of \
                      whatever it really is.

  up
    bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
           [[--hwaddr %hwaddr%]] --returniffail --serverbcast

  down
    ifconfig %iface% down

method ppp
  description
    This method uses pon/poff to configure a PPP interface. See those
    commands for details.
  options
    provider name  -- Use /name/ as the provider (from /etc/ppp/peers).
    unit number    -- Use /number/ as the ppp unit number.
    options string -- Pass /string/ as additional options to pon.
  up
    pon [[%provider%]] [[unit %unit%]] [[%options%]]
  down
    poff [[%provider%]]

method wvdial
  description
    This method uses wvdial to configure a PPP interface. See that command
    for more details.
  options
    provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
  up
    start-stop-daemon --start -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface%.pid -b -m -- [[ %provider% ]]
  down
    start-stop-daemon --stop -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface%.pid -s 2


method ipv4ll
  description
    This method uses avahi-autoipd to configure an interface with an
    IPv4 Link-Layer address (169.254.0.0/16 family). This method is also
    known as APIPA or IPAC, and often colloquially referred to
    as "Zeroconf address".
  up
    avahi-autoipd -D %iface%
  down
    avahi-autoipd --kill %iface%
architecture hurd

method loopback
  description
    This method may be used to define the IPv4 loopback interface.

  up
    inetutils-ifconfig --interface %iface% --address 127.0.0.1 --up \
	if (!iface_is_lo())

  down
    inetutils-ifconfig --interface %iface% --down \
	if (!iface_is_lo())

method static
  description
    This method may be used to define Ethernet interfaces with statically
    allocated IPv4 addresses.
      
  options
    address address             -- Address (dotted quad/netmask) *required*
    netmask mask                -- Netmask (dotted quad or number of bits) *deprecated*
    broadcast broadcast_address -- Broadcast address (dotted quad) *deprecated*
    metric metric               -- Routing metric for default gateway (integer)
    gateway address             -- Default gateway (dotted quad)
    pointopoint address         -- Address of other end point (dotted quad). \
                                   Note the spelling of "point-to".
    hwaddress address           -- Link local address (Not yet supported)
    mtu size                    -- MTU size

  conversion
    hwaddress cleanup_hwaddress

  up
    [[Warning: Option hwaddress: %hwaddress% not yet supported]]
    inetutils-ifconfig --interface %iface% --address %address% [[--netmask %netmask%]] \
    [[--broadcast %broadcast%]] [[--mtu %mtu%]] --up
    [[fsysopts /servers/socket/2 $(fsysopts /servers/socket/2) --gateway %gateway% ]]

  down
    inetutils-ifconfig --interface %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 dhcp
  description
    This method may be used to obtain an address via DHCP with any of
    the tools: dhclient, udhcpc, dhcpcd.
    (They have been listed in their order of precedence.)
    If you have a complicated DHCP setup you should
    note that some of these clients use their own configuration files
    and do not obtain their configuration information via *ifup*.

  options
    hostname hostname       -- Hostname to be requested (dhcpcd, udhcpc)
    leasetime leasetime     -- Preferred lease time in seconds (dhcpcd)
    vendor vendor_id        -- Vendor class identifier (dhcpcd)
    client client_id        -- Client identifier (dhcpcd, udhcpc) or "no" (dhclient)
    hwaddress address       -- Hardware Address (Not yet supported)

  conversion
    hwaddress cleanup_hwaddress

  up
    [[Warning: Option hwaddress: %hwaddress% not yet supported]]
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
        if (execable("dhclient"))
    udhcpc -n -p /run/udhcpc.%iface///.%.pid -i %iface% [[-H %hostname%]] \
           [[-c %client%]] \
        elsif (execable("udhcpc"))
    dhcpcd [[-h %hostname%]] [[-i %vendor%]] [[-I %client%]] \
           [[-l %leasetime%]] %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

  down
    CLIENT="-i"; [[[ "%client%" = no ] && CLIENT="";]] dhclient -4 -v $CLIENT -r -pf /run/dhclient.%iface///.%.pid -lf /var/lib/dhcp/dhclient.%iface///.%.leases -I -df /var/lib/dhcp/dhclient6.%iface///.%.leases %iface% \
        if (execable("dhclient"))
    if test -f /run/udhcpc.%iface///.%.pid; then kill -USR2 $(cat /run/udhcpc.%iface///.%.pid); kill -TERM $(cat /run/udhcpc.%iface///.%.pid); fi \
        elsif (execable("udhcpc"))
    dhcpcd -k %iface% \
        elsif (execable("dhcpcd"))
    echo 'No DHCP client software found!' >&2; false \
        elsif (1)

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

method bootp
  description
    This method may be used to obtain an address via bootp.

  options
    bootfile file  -- Tell the server to use /file/ as the bootfile.
    server address -- Use the IP address /address/ to communicate with \
                      the server.
    hwaddr addr    -- Use /addr/ as the hardware address instead of \
                      whatever it really is.

  up
    bootpc [[--bootfile %bootfile%]] --dev %iface% [[--server %server%]] \
           [[--hwaddr %hwaddr%]] --returniffail --serverbcast

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

method ppp
  description
    This method uses pon/poff to configure a PPP interface. See those
    commands for details.
  options
    provider name  -- Use /name/ as the provider (from /etc/ppp/peers).
    unit number    -- Use /number/ as the ppp unit number.
    options string -- Pass /string/ as additional options to pon.
  up
    pon [[%provider%]] [[unit %unit%]] [[%options%]]
  down
    poff [[%provider%]]

method wvdial
  description
    This method uses wvdial to configure a PPP interface. See that command
    for more details.
  options
    provider name  -- Use /name/ as the provider (from /etc/wvdial.conf).
  up
    start-stop-daemon --start -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface///.%.pid -b -m -- [[ %provider% ]]
  down
    start-stop-daemon --stop -x /usr/bin/wvdial \
                      -p /run/wvdial.%iface///.%.pid -s 2


method ipv4ll
  description
    This method uses avahi-autoipd to configure an interface with an
    IPv4 Link-Layer address (169.254.0.0/16 family). This method is also
    known as APIPA or IPAC, and often colloquially referred to
    as "Zeroconf address".
  up
    avahi-autoipd -D %iface%
  down
    avahi-autoipd --kill %iface%