apt-get install nice flac shntool
#!/bin/bash
# split image file (flac, ape, wav, etc.) according to cue-file
if [ -f "$1" ]; then
i=0
for cuefile in *.cue; do
i=$(($i + 1))
done
if [ $i -eq 1 ]; then
# precies 1 cuesheet gevonden
if grep -q "INDEX 01 00:00:00" *.cue ; then
nice shntool split -t "%n %t" -f *.cue "$1"
else
echo "The first track has a pre-gap. Shntool will cut that off and put it in a seperate file."
echo "You don't want that. Please modify the cuesheet from:"
grep -m1 "INDEX 00" *.cue
grep -m1 "INDEX 01" *.cue
echo "to:"
echo " INDEX 01 00:00:00"
exit 1
fi
elif [ $i -eq 0 ]; then
echo "No cuesheet found in the current directory."
exit 1
elif [ $i -gt 1 ]; then
echo "$i cuesheets found in the current directory. Please remove the superfluous cuesheets."
exit 1
fi
else
echo "Split image file (flac, ape, wav, etc.) according to cue-file."
echo "Output files are in FLAC."
echo "Usage: `basename $0` "
exit 1
fi
echo
album=`grep -m 1 TITLE *.cue | cut -d\" -f2`
artist=`grep -m 1 PERFORMER *.cue | cut -d\" -f2`
for file in [0-9]*.wav; do
echo "Encoding $file"
if [[ ${file:0:1} == 0 ]] ; then
tracknr=${file:1:1}
else
tracknr=${file:0:2}
fi
title=`echo ${file:2} | sed -e "s/.wav$//"`
nice flac -s -T "artist=$artist" -T "album=$album" -T "title=$title" \
-T "tracknumber=$tracknr" "$file" && rm "$file"
done
Source: Speek
GRE is a tunneling protocol that was originally developed by Cisco, and it can do a few more things than IP-in-IP tunneling. For example, you can also transport multicast traffic and IPv6 through a GRE tunnel.
We are using Debian with linux kernel 2.4.26.
In Linux, you'll need the ip_gre.o module.
We have 2 routers X and Y, and intermediate network C (or let's say, Internet).
router X
Router X is connected to the Internet on interface eth0 and network A on eth1.
router Y
Router Y is connected to the Internet on interface eth0, network B on eth1 and network C on eth2.
interface eth1 :: address 10.0.3.1, network 10.0.3.0/24 (network B)
interface eth2 :: address 10.0.4.1, network 10.0.4.0/24 (network C)
As far as network C is concerned, we assume that it will pass any packet sent from X to Y and vice versa. How and why, we do not care.
Create a tunnel between router X and Y, such that we can route traffic from network A (connected to X) to networks
B and C (connected to Y).
This tunnel will look just like a wire between the two routers with its own subnet (10.0.201.0/24
Create Tunnels
On router X, commands are
ifconfig tunX 10.0.201.1/24
ifconfig tunX up
ifconfig tunX pointopoint 10.0.201.2
ifconfig tunX multicast
Furthermore we told it to use the GRE protocol (mode gre), that the remote address is 207.241.237.37 (the router Y at the other end), that our tunneling packets should originate from 169.229.255.134 (which allows your router to have several interfaces and choose which one to use for tunneling) and that the TTL field of the packet should be set to 255 (ttl 255).
Line 2 gives the newly born interface tunY the address 10.0.201.1.
Line 3 enables the device.
Line 4 is necessary to set the IP address of the peer. Need when using dynamic routing with RIP/OSPF with Zebra. Refer to Routing HOWTO for more details.
Line 5 is necessary to enable multicast - so that routing with Zebra works (they normally multicast routing updates).
One router Y, commands are
ifconfig tunY 10.0.201.2/24
ifconfig tunY up
ifconfig tunY pointopoint 10.0.201.1
ifconfig tunY multicast
Tunnel X<->Y
Now we created a tunnel on the 10.0.201.0/24 network from router X to Y and vice versa.
10.0.201.1 10.0.201.2
(tunX) (tunY)
We can send packets on the 10.0.201.0/24 network from router X to Y and vice versa.
So we can ping router X from Y on the tunnel interface.
However, if we to send packets to network B or C from router X, we need to add routes so that traffic
for these networks is sent on the tunnelling interface.
On router X:
route add -net 10.0.4.1/24 gw 10.0.201.1 dev tunX
Similarily, to send packets to network A from router Y, we need to add a route.
On router Y:
On router X:
iptunnel del tunX
|
___|_________
| Router X |
|_____________|
| 169.229.255.134 (eth0)
| (Internet or network C)
|
|
| | 10.0.201.1 (tunX)
| |
| |
| | (gre tunnel: 169.229.255.134 <-> 207.241.237.37)
| |
| |
| | 10.0.201.2 (tunY)
|
| (Internet or network C)
| 207.241.237.37 (eth0)
___|___________
| Router Y |
|_______________|
| |
| |
10.0.3.1 10.0.4.1
eth1 eth2
(network B) (network C)
- router X: /etc/network/interfaces
iface tun0 inet static
address 10.0.201.1
netmask 255.255.255.0
broadcast 10.0.201.255
up ifconfig tun0 multicast
pre-up iptunnel add tun0 mode gre remote 207.241.237.37 local 169.229.255.134 ttl 255
pointopoint 10.0.201.2
post-down iptunnel del tun0
- router Y: /etc/network/interfaces
iface tun0 inet static
address 10.0.201.2
netmask 255.255.255.0
broadcast 10.0.201.255
up ifconfig tun0 multicast
pre-up iptunnel add tun0 mode gre local 207.241.237.37 remote 169.229.255.134 ttl 255
pointopoint 10.0.201.1
post-down iptunnel del tun0
- Borrowed heavily from Linux Advanced Routing & Traffic Control HOWTO by Bert Hubert et al., 2002
- Discussion on IP tunnels with Quagga
- Retrieved from "http://tier.cs.berkeley.edu/wiki/HOWTO:IPTunnelling"