#!/bin/sh

IFACE=vmnet1

echo "Configuring wired interface"
#ifconfig eth0 10.0.0.1 netmask 255.255.0.0 up

echo "Configuring routing"
route add -net -n 10.0.0.0 netmask 255.255.0.0 dev $IFACE




# delete old configuration, if any
echo "Flush all the rules in filter and nat tables"
iptables --flush           
iptables --table nat --flush

echo "delete all chains that are not in default filter and nat table, if any"
iptables --delete-chain     
iptables --table nat --delete-chain

echo "Set up IP FORWARDing and Masquerading (NAT)"
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface $IFACE -j ACCEPT

echo "enable IP forwarding"
echo 1 > /proc/sys/net/ipv4/ip_forward








