Hi all, Sitting next to Luca in Debconf, I wanted to automate the DNS forwarding for the Freerunner when it runs on USB networking. So we merged our scripts into one, and here's the result. I stored in in /usr/local/sbin/freerunner-net, and symlinked it into /etc/network/if-up.d and /etc/network/if-down.d. And now it works :-) I'd store it in the wiki, but I don't have my identifiers at hand. Feel free to use, enhance and share.
Roland. -- Roland Mas ...sur un portable, quelque part dans le monde... ...on a laptop, somewhere in the world...
#! /bin/sh if [ "$IFACE" != usb0 ] ; then exit 0 fi case "$MODE" in start) echo 1 > /proc/sys/net/ipv4/ip_forward iptables -A POSTROUTING -t nat -o eth0 -j MASQUERADE iptables -A POSTROUTING -t nat -o eth1 -j MASQUERADE iptables -A FORWARD -i usb0 -j ACCEPT iptables -A FORWARD -o usb0 -j ACCEPT iptables -t nat -s 192.168.0.202 -A PREROUTING -j DNAT \ -d 192.168.0.200 -p udp --dport 53 \ --to-destination $(grep -m 1 nameserver /etc/resolv.conf | cut -d ' ' -f 2) iptables -t nat -s 192.168.0.202 -A PREROUTING -j DNAT \ -d 192.168.0.200 -p tcp --dport 53 \ --to-destination $(grep -m 1 nameserver /etc/resolv.conf | cut -d ' ' -f 2) ;; stop) echo 0 > /proc/sys/net/ipv4/ip_forward iptables -D POSTROUTING -t nat -o eth0 -j MASQUERADE iptables -D POSTROUTING -t nat -o eth1 -j MASQUERADE iptables -D FORWARD -i usb0 -j ACCEPT iptables -D FORWARD -o usb0 -j ACCEPT iptables -t nat -s 192.168.0.202 -D PREROUTING -j DNAT \ -d 192.168.0.200 -p udp --dport 53 \ --to-destination $(grep -m 1 nameserver /etc/resolv.conf | cut -d ' ' -f 2) iptables -t nat -s 192.168.0.202 -D PREROUTING -j DNAT \ -d 192.168.0.200 -p tcp --dport 53 \ --to-destination $(grep -m 1 nameserver /etc/resolv.conf | cut -d ' ' -f 2) ;; *) echo "Usage: $0 [up|down]" exit 1 ;; esac
_______________________________________________ Smartphones-userland mailing list Smartphones-userland@linuxtogo.org http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/smartphones-userland