Jump to content

ICS through 2nd WIFI Card?


littletone2002
 Share

Recommended Posts

Yo littletone,

I tried for days to get that to work w/ the network module and the easy point and click was to hard for me. I ended up making my own connection script w/ ipforwarding to get mine up and running. I'll attach it so you can adjust for yourself. Some of it I'll admit was cut and paste from Darrens' mp4.sh script but hey, whatever works right?! :) If someone wants to enlighten me on how to get that Netwok Module working I'm all ears! After hours of messing w/ it I couldn't get mine working at all though.

#!/bin/bash
echo "*****************************************************************************************"
echo "-----------------------------------------------------------------------------------------"
echo ""
echo -n "This scrip will 1st change the MAC of the desired NIC and then connect to a network."
echo ""
echo "Turning on available NICs: "
ifconfig wlan1 up
ifconfig wlan2 up
ifconfig wlan3 up
echo ""
echo -n "Available NICs to setup: "
echo ""
echo ""
ifconfig |grep "Link encap"
echo ""
echo -n "What NIC are you setting up? "
read NIC
echo "Finding available wireless networks in your area.........."
echo ""
iwlist $NIC scan |grep ESSID
echo ""
echo ""
echo -n "Whats the wireless network you're attaching to? "
read ESSID
echo -n "Whats the wireless passphrase? (Leave blank if OPN network) "
read PASSPHRASE
echo -n "Is this a WPA/WPA2 encrypted network? [y] "
read WPA
if [[ -z $WPA ]];
then
WPA=y
fi
killall wpa_supplicant &
killall udhcpc
sleep 2s
# set up WPA wireless connection if selected
if [[ $WPA == "y" || $WPA == "Y" ]];
then
ifconfig $NIC down
macchanger $NIC -A
ifconfig $NIC up
# print iwconfig for trouble shootign if needed
#iwconfig $NIC 
echo "network={" > wpa.conf
echo -e "\t\tssid=\"$ESSID\"" >> wpa.conf
echo -e "\t\tpsk=\"$PASSPHRASE\"\n\t\t}" >> wpa.conf
sleep 2
wpa_supplicant -B -D nl80211 -i $NIC -c wpa.conf
rm -f wpa.conf
fi
# setup WEP/OPN wireless connections
if [[ $WPA == "n" || $WPA == "N" ]];
then
ifconfig $NIC down
macchanger $NIC -A
ifconfig $NIC up
iwconfig $NIC essid $ESSID $PASSPHRASE
fi
#remove default route
route del default && echo "Default route removed" || echo "No Default route set"
udhcpc -i $NIC --release
sleep 2
echo -n "Would you like to setup ipforwarding via iptables? [y] "
read IPTABLES
if [[ -z $IPTABLES ]];
then
IPTABLES=y # default yes answer
echo '1' > /proc/sys/net/ipv4/ip_forward
#echo -n "IP Forwarding enabled. /proc/sys/net/ipv4/ip_forward set to "
#cat /proc/sys/net/ipv4/ip_forward

#clear chains and rules
iptables -X
iptables -F
#echo iptables chains and rules cleared
#setup IP forwarding
echo ""
echo ""
ifconfig |grep -A 1 br-lan
ifconfig |grep -A 1 eth0
ifconfig |grep -A 1 eth1
ifconfig |grep -A 1 wlan0
ifconfig |grep -A 1 wlan1
echo ""
echo -n "Pineapple Network [172.16.42.0/24]: "
read PINEAPPLENET
if [[ -z $PINEAPPLENET ]];
then
PINEAPPLENET=172.16.42.0/24 # Pineapple network. Default is 172.16.42.0/24
fi
echo -n "Interface of Pineapple's client network [br-lan]: "
read PINEAPPLELAN
if [[ -z $PINEAPPLELAN ]];
then
PINEAPPLELAN=br-lan #Interface w/ all clients "got" by the Pineapple
fi

echo -n "Interface between Live Network and Pineapple [wlan1]: "
read PINEAPPLEWAN
if [[ -z $PINEAPPLEWAN ]];
then
PINEAPPLEWAN=wlan1 # Interface of live network supplying internet to Pineapple
fi
iptables -A FORWARD -i $PINEAPPLEWAN -o $PINEAPPLELAN -s $PINEAPPLENET -m state --state NEW -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
echo "IP Forwarding Enabled"

fi

Edited by duckmanjbr
Link to comment
Share on other sites

@petertfm- I saw that writeup. That's also not through the GUI though. I think he and I are doing the same thing I just made my script a little less hard coded and more user friendly. Basically I automated it. I was looking to build something that would work outta the box for more than just me.

Link to comment
Share on other sites

  • 8 months later...

I had no problem with the Wifi Manager once I knew what I was doing.

What I did after setting up the wifi connection was to make sure I could reach the Internet by "revealing the public ip" on the main page. Then you just need to go back to the WiFi Manager and set the ICS to from wlan1 to br-lan. Change wlan1 to whatever your card is using. Then you should see the new route appear in the routing table.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...