Recently I had to install Windows XP to run under qemu on Debian to be able to run some chat program which cannot be run in Linux/Wine. I used to work from laptop, however I have a workstation so I decided to run qemu on it to minimize CPU load on a laptop. However, I needed to make sound to work on the network so I could hear chat alerts on the laptop.
Herebelow is what I did.
On the workstation:
Created /home/phaoost/bin/winxp.sh:
#!/bin/sh
export QEMU_AUDIO_DRV=pa
export QEMU_PA_SAMPLES=512 # Experimental values
export QEMU_PA_DIVISOR=0 # on which I got the sound with no jitter
ARGS="-usb -usbdevice tablet -usbdevice host:auto:*.* -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=/etc/qemu-ifup -m 1024 -localtime -hdc /dev/sda -soundhw sb16 /var/pub/winxp.dsk"
/usr/sbin/tunctl -u phaoost -t tap0
echo "Starting QEMU with..."
echo $ARGS
echo "...."
exec kvm $ARGS
Added to /etc/sudoers:
Cmnd_Alias QEMU=/sbin/ifconfig, \
/sbin/modprobe, \
/usr/sbin/brctl
phaoost ALL=NOPASSWD: QEMU
Created /etc/qemu-ifup:
#!/bin/sh
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
Added to /etc/pulse/client.conf:
default-server = tcp:172.16.17.3:4713 # Laptop IP
Adjusted /etc/network/interfaces with following:
auto br0
iface br0 inet static
address 172.16.17.7
netmask 255.255.255.224
gateway 172.16.17.30
bridge_ports eth1
bridge_fd 9
bridge_hello 2
bridge_maxage 12
bridge_stp off
# The primary network interface
allow-hotplug eth0
iface eth0 inet dhcp
#allow-hotplug eth1
iface eth1 inet manual
On the laptop:
In /etc/pulse/default.pa added the following line:
load-module module-native-protocol-tcp auth-ip-acl=172.16.17.0/27 # My LAN
After that I could capture all windows sounds on a laptop.
Pretty easy, however it took me hours of research to make it work ![]()
Quick setup IP-over-IP (protocol 4) tunnel on Debian 5.0
192.168.x.x - router LAN IP
192.168.x.y - local LAN IP
172.16.x.x - router tunnel IP
172.16.x.y - local tunnel IP
On router add to /etc/network/interfaces:
# ipip tunnel
iface ipip0 inet static
address 172.16.x.x
netmask 255.255.255.255
pointopoint 172.16.x.y
mtu 1480
pre-up /sbin/ip tunnel add ipip0 mode ipip remote 192.168.x.y local 192.168.x.x dev eth0
post-down /sbin/ip tunnel del ipip0
On local system add same lines to /etc/network/interfaces switching local and remote IPs. Then use ifup/ifdown to add/remove ipip0 interface
Following rule may need to exist in iptables mangle table on both systems:
-A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
scratchbox and maemo sdk using i386 binaries which will work fine on amd64 though.
First, download maemo-scratchbox-install_4.1.1.sh and comment out 'exit 1' at line 447.
Then run it with:
sudo bash maemo-scratchbox-install_4.1.1.sh -s /scratchbox
If you get
Inconsistency detected by ld.so: rtld.c: 1192: dl_main: Assertion `(void *) ph->p_vaddr == _rtld_local._dl_sysinfo_dso' failed!
after running /scratchbox/login you may need to add to /etc/sysctl.conf following lines:
vm.mmap_min_addr = 4096
abi.vsyscall32 = 0
Then run sudo sysctl -p and proceed with installation.
This short article describes how to set up PPTP or OpenVPN connection and leave default gateway to point to ISP on a Linux router while having incoming connectivity from a VPN.
1. Download router-script.sh. Edit DEV_GW and DEV_TUN to point to proper devices (see route -n output to determine which devices are used). DEV_GW is a device which connected with your ISP and TUN_GW - VPN device (usually ppp0 for PPTP or tun0 for OpenVPN)
2. If you are using OpenVPN, comment out 'redirect-gateway' keyword in configuration file. Establish a VPN connection on the router.
3. Run router-script.sh after VPN connection established.