I need to use a WiFi hotspot to connect my home network to the Internet. 
I have a WiFi tablet, a laptop with one WiFi and one Ethernet port, and 
a router. The router will serve both WiFi and Ethernet locally. The 
network will look like this:

hotspot --> laptop --> router --> house network

The tablet hotspot runs a DHCP server, giving out addresses in the range 
192.168.43.xxx.
The router runs a DHCP server, giving out addresses in the range 
192.168.0.xxx.
The laptop needs to talk to the hotspot through WiFi, and to the router 
through Ethernet.

The Ethernet connection on the laptop needs to be in a different range 
than its WiFi port, so the following goes into /etc/network/interfaces 
on the laptop:

auto eth0
iface eth0 inet static
        address 10.253.0.1
        netmask 255.255.255.0
        network 10.253.0.0

The router's Wan port needs to be in the same range as the laptop's 
Ethernet port, so I set it this way:

    ip: 10.253.0.2
    netmask: 255.255.255.0
    gateway: 10.253.0.1
    dns: 8.8.8.8

Back on the laptop, it needs an iptables rule to do the NAT.  The 
wireless interface on the laptop is wlan0, so run the following:

    iptables -t nat -I POSTROUTING -o wlan0 -j MASQUERADE

The laptop also needs to have forwarding turned on. That requires a 
change to a setting in /proc. Sudo by itself is not sufficient to 
provide permission to make that change. Instead, a login shell owned by 
root is needed. To get that, run the following:

    sudo su -

Then run:

    echo 1 > /proc/sys/net/ipv4/conf/all/forwarding

Both the iptables rule and the change to 
/proc/sys/net/ipv4/conf/all/forwarding are temporary and need to be done 
again after rebooting. Putting them in a shell script to run at startup 
could automate it, but I expect this to be temporary, and so I'll just 
create a shell script in a file on the desktop of the laptop to remind 
me to run it whenever I power it back up. Once I set it up I'll just 
leave it up.

Many thanks to Russell and Rich for their support, and to this list for 
providing the space for the conversation.



-- 
Regards,

Dick Steffens

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to