1 .\" $NetBSD: ifconfig.if.5,v 1.12 2009/01/08 18:33:47 jakllsch Exp $
3 .\" Copyright (c) 1996 Matthew R. Green
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 .Nd interface-specific configuration files or variables
36 files or variables contain information regarding the configuration
37 of each network interface.
45 that is to be configured, there should be either an
55 .Pa /etc/ifconfig.fxp0
59 The variable or file will get evaluated only if the interface exists on
61 Multiple lines can be placed in a variable or file, and will be
62 evaluated sequentially.
63 In the case of a variable, semicolons may be used instead of
64 newlines, as described in
67 Normally, a line will be evaluated as command line arguments to
69 .Dq Li ifconfig Ar nnX
70 will be prepended on evaluation.
71 Arguments with embedded shell metacharacters should be quoted in
75 If the line is equal to
78 will be started for the interface.
80 If a line is empty, or starts with
82 the line will be ignored as comment.
86 the rest of line will get evaluated as shell script fragment.
87 Shell variables declared in
89 are accessible but may not be modified.
90 The most useful variable is
92 as it will be bound to the interface being configured with the file.
94 For example, the following illustrates static interface configuration:
95 .Bd -literal -offset indent
97 inet 10.0.1.12 netmask 255.255.255.0 media 100baseTX
98 inet 10.0.1.13 netmask 255.255.255.255 alias
99 # let us have IPv6 address on this interface
100 inet6 2001:db8::1 prefixlen 64 alias
101 # have subnet router anycast address too
102 inet6 2001:db8:: prefixlen 64 alias anycast
105 The following illustrates dynamic configuration setup with
109 .Bd -literal -offset indent
111 # autoconfigure IPv4 address
113 # autoconfigure IPv6 address. Be sure to set $ip6mode to autohost.
117 The following example sets a network name for a wireless interface
118 (using quotes to protect special characters in the name),
121 .Bd -literal -offset indent
126 The following example is for dynamically-created pseudo interfaces like
129 .Pa /etc/rc.d/network
132 command for such interfaces,
133 but creation is now handled automatically.
134 .Bd -literal -offset indent
136 # configure IPv6 default route toward the interface
137 !route add -inet6 default ::1
138 !route change -inet6 default -ifp $int
141 .Pa /etc/rc.d/network