#!/bin/bash
#
#script to set up Internet Sharing
GATEWAY_IF=wlan0
if !( /sbin/lsmod | grep 'ip_tables' ) && ( /sbin/modprobe -l ip_tables ); then
/sbin/modprobe ip_tables
echo "ip_tables is now loaded"
else
echo "ip_tables already loaded"
fi
if ( grep '0' /proc/sys/net/ipv4/ip_forward ); then
echo "1" > /proc/sys/net/ipv4/ip_forward
echo "IP forwarding is now enabled"
else
echo "IP forwarding already enabled"
fi
if !( /sbin/iptables -L -t nat -v | grep $GATEWAY_IF ); then
/sbin/iptables -t nat -A POSTROUTING -o $GATEWAY_IF -j MASQUERADE
echo "Routing is now enabled"
else
echo "Routing already setup on "$GATEWAY_IF
fi
echo "Setting IP..."
/sbin/ifconfig eth0 192.168.254.100
Home |
Blog |
Contact |
This site by Freemor is licensed under a Creative
Commons Attribution-ShareAlike 2.5 Canada License.
Permissions beyond the scope of this license may be available at
http://freemor.ca/Contact.htm.