3g modem accesspoint

#!/bin/sh -x
# Niels Elgaard larsen
# script to use eeePC 701 with USB 3g modem as accesspoint
# requires iptables, udhcpd


# /etc/udhcpd.conf should look like
#	start 		192.168.42.20
#	end		192.168.42.254
#	interface	ath0
#	opt     router  192.168.42.1 
#       opt dns 8.8.8.8

echo 1 > /proc/sys/net/ipv4/ip_forward

APDEV=eth0
NETDEV=ppp0	
echo stop dhcp clients
/etc/init.d/wicd stop

ifconfig $APDEV down

ifconfig $APDEV up
ifconfig $APDEV 192.168.42.1 netmask 255.255.255.0 up

iptables -t nat -A POSTROUTING -s 192.168.42.0/24 -o $NETDEV -j MASQUERADE


/sbin/iptables -A FORWARD -i $APDEV -o $NETDEV -j ACCEPT
/sbin/iptables -A FORWARD -o $NETDEV -i $APDEV -j ACCEPT

udhcpd
echo make sure your NET/GPRS connection is up
echo for example vodafone-mobile-connect-card-driver-for-linux

echo for example vodafone-mobile-connect-card-driver-for-linux

Last modified: Tue Aug 25 23:44:07 CEST 2009