… | |
… | |
28 | |
28 | |
29 | The only exception to the above is the "on" directive that can prefix any |
29 | The only exception to the above is the "on" directive that can prefix any |
30 | C<name = value> setting and will only "execute" it on the named node, or |
30 | C<name = value> setting and will only "execute" it on the named node, or |
31 | (if the nodename starts with "!") on all nodes except the named one. |
31 | (if the nodename starts with "!") on all nodes except the named one. |
32 | |
32 | |
33 | name = value |
33 | name = value |
34 | on branch1 loglevel = noise |
34 | on branch1 loglevel = noise |
35 | on !branch2 connect = ondemand |
35 | on !branch2 connect = ondemand |
36 | |
36 | |
37 | All settings are executed "in order", that is, later settings of the same |
37 | All settings are executed "in order", that is, later settings of the same |
38 | variable overwrite earlier ones. |
38 | variable overwrite earlier ones. |
39 | |
39 | |
40 | =head1 ANATOMY OF A CONFIG FILE |
40 | =head1 ANATOMY OF A CONFIG FILE |
… | |
… | |
147 | =item MAC=fe:fd:80:00:00:01 |
147 | =item MAC=fe:fd:80:00:00:01 |
148 | |
148 | |
149 | The MAC address to set the interface to. The script *must* set the |
149 | The MAC address to set the interface to. The script *must* set the |
150 | interface MAC to this value. On GNU/Linux you will most likely use this: |
150 | interface MAC to this value. On GNU/Linux you will most likely use this: |
151 | |
151 | |
152 | ip link set $IFNAME address $MAC mtu $MTU up |
152 | ip link set $IFNAME address $MAC mtu $MTU up |
153 | |
153 | |
154 | =item NODENAME=branch1 |
154 | =item NODENAME=branch1 |
155 | |
155 | |
156 | The nickname of the current node, as passed to the vped daemon. |
156 | The nickname of the current node, as passed to the vped daemon. |
157 | |
157 | |
… | |
… | |
162 | |
162 | |
163 | =back |
163 | =back |
164 | |
164 | |
165 | Here is a simple if-up script: |
165 | Here is a simple if-up script: |
166 | |
166 | |
167 | #!/bin/sh |
167 | #!/bin/sh |
168 | ip link set $IFNAME address $MAC mtu $MTU up |
168 | ip link set $IFNAME address $MAC mtu $MTU up |
169 | [ $NODENAME = branch1 ] && ip addr add 10.0.0.1 dev $IFNAME |
169 | [ $NODENAME = branch1 ] && ip addr add 10.0.0.1 dev $IFNAME |
170 | [ $NODENAME = branch2 ] && ip addr add 10.1.0.1 dev $IFNAME |
170 | [ $NODENAME = branch2 ] && ip addr add 10.1.0.1 dev $IFNAME |
171 | ip route add 10.0.0.0/8 dev $IFNAME |
171 | ip route add 10.0.0.0/8 dev $IFNAME |
172 | |
172 | |
173 | More complicated examples (using routing to reduce arp traffic) can be |
173 | More complicated examples (using routing to reduce arp traffic) can be |
174 | found in the etc/ subdirectory of the distribution. |
174 | found in the etc/ subdirectory of the distribution. |
175 | |
175 | |
176 | =item node-up = relative-or-absolute-path |
176 | =item node-up = relative-or-absolute-path |
… | |
… | |
207 | =back |
207 | =back |
208 | |
208 | |
209 | Here is a nontrivial example that uses nsupdate to update the name => ip |
209 | Here is a nontrivial example that uses nsupdate to update the name => ip |
210 | mapping in some dns zone: |
210 | mapping in some dns zone: |
211 | |
211 | |
212 | #!/bin/sh |
212 | #!/bin/sh |
213 | { |
213 | { |
214 | echo update delete $DESTNODE.lowttl.example.net. a |
214 | echo update delete $DESTNODE.lowttl.example.net. a |
215 | echo update add $DESTNODE.lowttl.example.net. 1 in a $DESTIP |
215 | echo update add $DESTNODE.lowttl.example.net. 1 in a $DESTIP |
216 | echo |
216 | echo |
217 | } | nsupdate -d -k $CONFBASE:key.example.net. |
217 | } | nsupdate -d -k $CONFBASE:key.example.net. |
218 | |
218 | |
219 | =item node-down = relative-or-absolute-path |
219 | =item node-down = relative-or-absolute-path |
220 | |
220 | |
221 | Same as C<node-up>, but gets called whenever a connection is lost. |
221 | Same as C<node-up>, but gets called whenever a connection is lost. |
222 | |
222 | |