Re: Mapping stanzas in interfaces file not working
On Tue, 2004-02-03 at 10:04, Adam Aube wrote: > One thought - what if ifup stops parsing the script line after the first > space? Try putting the path to the script and its arguments in quotes > in /etc/network/interfaces. If that doesn't work, try altering the script > so that, given no arguments other than the interface name, it acts as > though -l -q were given as arguments. > This occurred to me, as well, after I saw the output of ifup -v, and it turns out that it was actually part of the problem--just not the entire problem. You can only put a path name in the script line of a mapping section. It also turns out that what ifup/ifdown want the script to return is the logical interface name, not one of the keys listed on your map lines. I guess the idea is that your script should be programmed to know what the map keys are (eg WORK, HOME, 192.168.1/24, etc) but not necessarily what the logical interface names are; that's why the map lines are fed to the script's stdin. My setup is working now that my mapping script outputs logical interface names. The documentation probably should be updated to clarify the script output logistics and the syntax of the "script" statement. I'll file a bug when I get a chance. -- Chris Eisley <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Mapping stanzas in interfaces file not working
> mapping eth0 >script /etc/network/show-role.sh -q -l Here is one of the problems. You are not allowed to provide arguments ("-q", "-l") to the mapping script. -- Thomas Hood <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Mapping stanzas in interfaces file not working
On Tuesday 03 February 2004 12:37 pm, Chris Eisley wrote: > On Tue, 2004-02-03 at 07:46, Adam Aube wrote: >> Have you tried manually running "ifup -v eth0"? If so, what was the >> output? > > Did just now; What I get is: > > Running mapping script /etc/network/show-role.sh -q -l on eth0 > Ignoring unknown interface eth0=eth0. So ifup claims it is running the script. >>> The script I designate in the script line of the mapping stanza is >>> never being executed >> >> How do you know? > > I put the following in the script as the first line of execution: > > echo 1 > '/etc/network/blah' > > And the test file wasn't created; it was if I ran the script myself. That's generally a good indicator that the script is not being run. > Here are the contents of the script, which has 755 perms and root:root > ownership: Nothing looks wrong here. > When I run the role script as /etc/network/show-roles.sh -q -l eth0", > "INTERNAL-CEPHEUS" is the output. Which is the correct output, according to the man page. One thought - what if ifup stops parsing the script line after the first space? Try putting the path to the script and its arguments in quotes in /etc/network/interfaces. If that doesn't work, try altering the script so that, given no arguments other than the interface name, it acts as though -l -q were given as arguments. Adam -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Mapping stanzas in interfaces file not working
On Tue, 2004-02-03 at 07:46, Adam Aube wrote: > On Tuesday 03 February 2004 04:42 am, Chris Eisley wrote: > > The problem is that when I put the mapping entry in, ifup gives the > > error "Ignoring unknown interface eth0=eth0." > > Have you tried manually running "ifup -v eth0"? If so, what was the > output? > Did just now; What I get is: Running mapping script /etc/network/show-role.sh -q -l on eth0 Ignoring unknown interface eth0=eth0. > > The script I designate in the script line of the mapping stanza is never > > being executed > > How do you know? > I put the following in the script as the first line of execution: echo 1 > '/etc/network/blah' And the test file wasn't created; it was if I ran the script myself. Here are the contents of the script, which has 755 perms and root:root ownership: #!/bin/sh PATH="/bin:/sbin:/usr/bin:/usr/sbin" OUTPUT=terminal ROLE_FILE=/etc/network/roles function print_usage() { if [ "$1" ] then echo $1 fi cat <&2 exit 1 fi for l in `cat $ROLE_FILE` do CURRENT_IFACE=`echo "$l" | cut -d':' -f1` POSITION=`echo "$l" | cut -d':' -f2` NETWORK=`echo "$l" | cut -d':' -f3` if [ -z $CURRENT_IFACE ] || [ -z $POSITION ] then echo "Error: Unable to parse role file $ROLE_FILE" >&2 exit 1 elif [ $IFACE = 'all' ] || [ $CURRENT_IFACE = $IFACE ] then IFACE_FOUND=1 if [ $OUTPUT = 'terminal' ] then echo -n "$CURRENT_IFACE: $POSITION interface" if [ $NETWORK ] then echo " for $NETWORK" fi else echo -n "$POSITION" if [ $NETWORK ] then echo -n "-$NETWORK" fi fi fi done if [ -z $IFACE_FOUND ] then echo "Error: No entry for interface "$IFACE" in role file $ROLE_FILE" >&2 exit 1 fi fi The /etc/network/roles files contains: eth0:INTERNAL:CEPHEUS wlan0:EXTERNAL ppp0:DISABLED When I run the role script as /etc/network/show-roles.sh -q -l eth0", "INTERNAL-CEPHEUS" is the output. Thanks for taking a look. -- Chris Eisley <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Mapping stanzas in interfaces file not working
On Tuesday 03 February 2004 04:42 am, Chris Eisley wrote: > The problem is that when I put the mapping entry in, ifup gives the > error "Ignoring unknown interface eth0=eth0." Have you tried manually running "ifup -v eth0"? If so, what was the output? > The script I designate in the script line of the mapping stanza is never > being executed How do you know? > Here's what I'm trying. The iface lines you see below all work > perfectly when they use physical interface names instead of logical > ones (ie eth0 instead of eth0-whatever); in the past I was simply > uncommenting the one I wanted to use at the time. Can you also post the contents of /etc/network/show-role.sh? As far as I can tell (from the man page), your interfaces syntax is fine. Adam -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Mapping stanzas in interfaces file not working
Hello, I'm trying to switch over from commenting/uncommenting relevant iface stanzas (man pages call them stanzas, so no snipes about my lack of understanding of the word) in /etc/network/interfaces to using the mapping mechanism described in the interfaces man pages. The problem is that when I put the mapping entry in, ifup gives the error "Ignoring unknown interface eth0=eth0." The script I designate in the script line of the mapping stanza is never being executed and of course the eth0 interface isn't being configured. Here's what I'm trying. The iface lines you see below all work perfectly when they use physical interface names instead of logical ones (ie eth0 instead of eth0-whatever); in the past I was simply uncommenting the one I wanted to use at the time. # Logical mappings for Ethernet card mapping eth0 script /etc/network/show-role.sh -q -l map INTERNAL-WAPeth0-internal-wap map INTERNAL-CEPHEUSeth0-internal-cepheus map EXTERNALeth0-external map DHCPeth0-dhcp I then have corresponding iface entries with logical interface names: # Ethernet card acting as external interface on 192.168.1/24 net iface eth0-external inet static pre-up /etc/rc.firewall down /etc/rc.firewall dns-nameservers 172.16.0.1 dns-search cepheus.net address 192.168.1.2 gateway 192.168.1.1 network 192.168.1.0 broadcast 192.168.1.255 netmask 255.255.255.0 name Ethernet LAN (External Interface) # Ethernet card acting as internal interface on 192.168.2/24 net iface eth0-internal-cepheus inet static address 192.168.2.1 network 192.168.2.0 broadcast 192.168.2.255 name Ethernet LAN (Internal/Cepheus Interface) # Ethernet card acting as internal interface on 192.168.2/24 net iface eth0-internal-wap inet static address 192.168.1.2 network 192.168.1.0 broadcast 192.168.1.255 name Ethernet LAN (Internal/WAP Interface) -- Chris Eisley <[EMAIL PROTECTED]> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]