I have had some success, but it still isn't working properly:
I followed the advice of luck.anshu and manually set my wireless (ath0) on the laptop to 192.168.1.101, set the wired (eth0) on the laptop to 192.168.1.102 and set the eth0 on the desktop to 192.168.1.103.
The desktop has the gateway set to 192.168.1.101 (i.e. the wireless connection on the laptop).
The eth0 (192.168.1.102) on the laptop also has the gateway set to 192.168.1.101 (the wireless connection on the laptop).
The ath0 (wireless 192.168.1.101) on the laptop has the gateway set to 192.168.1.1 which is the BT Voyager 2100 router that connects to the internet.
I ran the following commands:
sudo iptables -F
sudo iptables -F -t nat
sudo iptables -F -t mangle
sudo iptables -I INPUT -s 192.168.1.103 -j ACCEPT
sudo iptables -I FORWARD -s 192.168.1.103 -j ACCEPT
sudo iptables -I POSTROUTING -t nat -s 192.168.1.103 -o ath0 -j MASQUERADE
After this, the following is the output from listing the iptables:
----------------------------------------------
xxx@yyyy:~$ sudo iptables -L
[sudo] password for xxx:
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- zzzzz.local anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- zzzzz.local anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
----------------------------------------------
----------------------------------------------
xxx@yyyy:~$ sudo iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- zzzzz.local anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
----------------------------------------------
Plugging the crossover cable in between the laptop and the desktop does connect them, and each one can ping the other. But trying to ping a
www.google.com address fails from the desktop.
Also, given the laptop is named yyyy and the desktop is named zzzzz, a ping of yyyy.local from zzzzz resolves the address (as 192.168.1.102) but it takes about 20secs per ping to give a result line, although the time= value is less that 0.4ms.
When the laptop and desktop are connected then a ping of
www.google.com from the laptop fails, but when I unplug the crossover cable the ping to
www.google.com is successful.
What am I doing wrong here?