You are not logged in.
I will try to explain you what I want to do, I would need help from more experience users.
AP----PC1----PC2
So PC1 is connected to AP, which is a router to internet. This part is not so important.
I need to use wlan on PC1 to share connection to PC2. How to to that? PC1 has 2 wlan interfaces.
Ok, I need to use wlan AP mode, and then what? Is proxy software enough (polipo) or do I need to mess around with dnsmasq, dhcp or else?
Thank you in advance.
Offline
Connect PC1 wlan0 to the AP (Managed mode). Connect PC1 wlan1 to PC2 wlan0 (Ad-hoc mode). Then share the wlan0 connection by enabling ip_forwarding, and a few iptables rules. You could use the Arch iptables service to load your saved rules from /etc/iptables/iptables.rules.
I use this script for quick sharing when I'm on the road: # ./rc.firewall start nat
Last edited by anrxc (2010-06-22 21:51:27)
You need to install an RTFM interface.
Offline
Ya, connect the one Wireless NIC to the AP... then start the other Wireless NIC in Ad-hoc mode and give it an ip address . It makes this simpler to set static IP's.
Okay it felt like fun to write a scrip too. So now you have two scripts to try out. Mine will ask you what NIC is what and what ESSID and Channel to use and suff. But you can just hit Enter,Enter.. Enter and it will set it up with defaults for you.
- On PC1 -
wlan0 = AP connected NIC
wlan1 = NIC for sharing connection
#!/bin/bash
#
# Interactive script to setup Internet connection sharing form one NIC to another NIC
#
Default_AP_connected_NIC="wlan0"
Default_sharing_NIC="wlan1"
Default_shared_essid="SharedNet"
Default_shared_channel="3"
Default_IP_address="10.0.0.1"
Default_IP_netmask="255.255.255.0"
Default_IP_CIDR="10.0.0.0/24"
USER=`whoami`
if [ $USER == "root" ]; then
read -p "What NIC is connected to the AP, (default wlan0), ? " AP_connected_NIC
read -p "What NIC is would you like to use to Share Internet from, (default wlan1), ? " sharing_NIC
read -p "What would you like the ESSID to be, (default SharedNet), ? " shared_essid
read -p "What channel would you like the SharedNet to be on, (default 3), ? " shared_channel
if [ -z $AP_connected_NIC ]; then
AP_connected_NIC=$Default_AP_connected
else
fi
if [ -z $sharing_NIC ]; then
sharing_NIC=$Default_sharing_NIC
else
fi
if [ -z $shared_essid ]; then
shared_essid=$Default_shared_essid
else
fi
if [ -z $shared_channel ]; then
shared_channel=$Default_shared_channel
else
fi
ifconfig $sharing_NIC down
iwconfig $sharing_NIC mode ad-hoc
iwconfig $sharing_NIC channel $shared_channel essid $shared_essid
ifconfig $sharing_NIC $Default_IP_address netmask $Default_IP_netmask up
iptables -A FORWARD -i $sharing_NIC -o $AP_connected_NIC -s $Default_IP_CIDR -m state --state NEW -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A POSTROUTING -t nat -j MASQUERADE
echo 1 /proc/sys/net/ipv4/ip_forward
else
echo "Please run as root."
fi
exit- On PC2 -
On PC2 set it your network manager to use a Static IP of 10.0.0.2 for the Wireless network.
Last edited by hunterthomson (2010-06-25 08:17:27)
OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec
Offline