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
|
ifscheme
--------
'ifscheme' is a small utility specific to the Debian
distribution. You can use it as a mapping for ifup to manage user
selected network schemes.
To install this package, just copy the two shell scripts into
/usr/local/bin. Or use the Debian package ;-)
Joey Hess <joey@dragon.kitenet.net> is the author of
'ifscheme", I just collected it because I use it. Below you will find
the author's original explanation. More details can be found in the
man page or in the documentation of Wireless Tools.
Jean II
-------------------------------------------------------------
/etc/network/interfaces is much more flexible than it appears. It can probably
do everything pcmcia schemes can do, and more. Here is part of mine:
auto wlan0
mapping wlan0
script /sbin/ifscheme-mapping
iface wlan0-home inet static
address 192.168.1.5
gateway 192.168.1.1
netmask 255.255.255.0
wireless_mode ad-hoc
wireless_essid wortroot
wireless_nick dragon
wireless_channel 1
iface wlan0-away inet dhcp
wireless_mode managed
Now I can type 'ifscheme -s away' when I leave home, rather like
cardctl scheme.
The ifscheme script is at http://bugs.debian.org/154444. If the request in
bug #154442 is implemented, it will become very flexible indeed..
Debian will hopefully be using this same file eventually for pcmcia network
devices too. It's already doable but takes a little work. This is all rather
rough and badly documented so far.
You can also do mapping based on the MAC address, if you want specific
configuration on specific card. See
/usr/share/doc/ifupdown/examples/get-mac-address.sh and the stanza in
/usr/share/doc/ifupdown/examples/network-interfaces.gz that uses it.
This comes back to the problem I alluded to with mapping scripts not
being "nestable" yet, and bug #154442. You can do what you want today,
but you may need to write your own mapping script which uses a
combination of MAC address and scheme info to return a stanza name to
ifupdown.
-------------------------------------------------------------
Hugo Haas <hugo@larve.net> added support for "map" statements
in mapping :
------------
mapping eth0
script /sbin/ifscheme-mapping
map eth0-local eth0-local
map eth0-masq masquerading
map eth0-* anywhere
iface eth0-static inet static
address 10.0.0.3
iface masquerading inet static
address 192.168.1.1
iface anywhere inet dhcp
------------
There is only a few gotchas with those explicit 'map' statements.
First, you don't want to use a mapping name that is an
existing interface name or a different scheme name.
You will notice is that 'ifscheme' may reconfigure the
interface in case where it doesn't need to be when you are using
wildcard. In the example above, if you change scheme from 'any' to
'where', the interface is reconfigured.
Jean II
|