Re: How to share the Internet with Linux and an iPad by Wi-Fi?
On Mon, 2012-02-20 at 11:59 +0200, Andrei POPESCU wrote:
> On Du, 19 feb 12, 12:58:19, Ralf Mardorf wrote:
> >
> > I only enabled wireless, the DSL connection isn't set up by nm, it was
> > set up by pppoeconf and starts automatically at startup.
>
> You're probably better of doing it by hand, aproximate steps from
> memory:
>
> - disable network manager
> - configure wlan0 with a static IP + netmask in /etc/network/interfaces
> (but no gateway, this is important)
> - install hostapd, dnsmasq and resolvconf if not already installed
> - configure hostapd: which interface (wlan0), wpa2, wpa2 passphrase
> - configure dnsmasq as DHCP server (uncomment one of the network
> definitions in /etc/dnsmasq.conf)
> - enable IP forwarding: I usually do this with shorewall since in such
> cases I need a firewall anyway
> - if MTU for you pppoe is set to 1492 you may need to clamp MSS to Path
> MTU Discovery[1] (with shorewall or the iptables command mentioned on
> that page
>
> [1] http://lartc.org/howto/lartc.cookbook.mtu-mss.html
>
> Kind regards,
> Andrei
Thank you Andrei,
I already tried this, but I'll try again, since your information allows
me to google more precise. I'm uncertain if I should test Wicd first.
Kind regards,
Ralf
PS:
The iwconfig part seems to be ok, the iptables part isn't.
$ cat adhoc
#! /bin/sh
# sh ./adhoc
# https://help.ubuntu.com/community/WifiDocs/Adhoc
device=wlan0
sudo service network-manager stop
sudo ip link set $device down
sudo iwconfig $device mode ad-hoc
sudo iwconfig $device channel 4
sudo iwconfig $device essid 'oz'
sudo iwconfig $device key 1324354657
# sudo dhclient $device
sudo ip addr add 169.254.34.2/16 dev $device
#
http://www.linuxquestions.org/questions/slackware-14/routing-ip-masquerade-nat-question-880715/
# default policies
sudo iptables -t nat -P POSTROUTING ACCEPT
sudo iptables -t nat -P OUTPUT ACCEPT
sudo iptables -t nat -P PREROUTING ACCEPT
sudo iptables -t filter -P INPUT DROP
sudo iptables -t filter -P FORWARD DROP
sudo iptables -t filter -P OUTPUT DROP
# NAT on behalf of secondary LAN
sudo iptables -t nat -A POSTROUTING -s 192.168.2.0/255.255.255.0 -j SNAT
\
--to-source 192.168.1.xxx
# forward packets from/to secondary LAN
sudo iptables -t filter -A FORWARD -s 192.168.2.0/255.255.255.0 -j
ACCEPT
sudo iptables -t filter -A FORWARD -d 192.168.2.0/255.255.255.0 -j
ACCEPT
exit 0
Reply to: