[nSLUG] WiFi and ethernet too: how to make eth0 & wlan0 both work?

Stephen Gregory nslug at kernelpanic.ca
Sat Feb 25 02:48:34 AST 2017


On the laptop you only need the default route pointing to the ip
address of the phone. WICD would have set this for you automatically.
No additional routes should be required (on the laptop) for your
setup[1].

The phone subnet must be different from your LAN. so 192.168.1.x or
whatever. you can set this is the internet settings of the phone.

On the wired side of your laptop you need an ip address in the
192.168.0.x network. You do not want to set another gateway on the
laptop that points to the LAN. This would conflict with the wireless
gateway.

WICD should let you configure both Wifi and Ethernet simultaneously.
You might need to create a second Ethernet profile that does not
include a gateway. I haven't used WICD in years.

Now that you have
- a Wifi ip address
- a Lan address
- a default gateway set to the phone
you need to
- configure the other computers to send packets to the laptop
- configure the laptop to pass packets from the LAN to WiFi and back.

On each LAN device set the gateway (aka default gateway) to the LAN ip
address of the laptop.

On the laptop you need a simple firewall

#!/bin/bash

WIFI=<name of wifi dev e.g. wlan0>
LAN=<name of lan dev e.g. eth0>

iptables -P FORWARD DROP
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i $LAN -o $WIFI -j ACCEPT

iptables -t nat   -A POSTROUTING -o "$WIFI" -j MASQUERADE

sysctl -w net.ipv4.ip_forward=1










On 25 February 2017 at 01:24, Mike Spencer <mspencer at tallships.ca> wrote:
>
>
> Thanks Dop & Hatem for pointers.  The phone with an IP data channel
> was just visiting and has gone away but will be back betimes.  You've
> suggested enough key words that I can do some reading in the meantime.
>
> My home LAN is configured with fixed addresses in 192.168.0.x in
> /etc/hosts for all working computers including the old ones collecting
> dust.  Hitherto, I've just cookbooked DHCP when away from home with
> the laptop, doing whatever wicd(1) seems to want and having good luck.
> There are well over 50 (!)  RFCs on DHCP and even the few that might
> be instructional make an intimidating bunch, especially considering
> that I'm also weak on just how the route(8) utility works.
>
> I get it that there has to be two routes (for the real net and for the
> LAN) but I don't really understand it yet.  So I'll do some reading
> and maybe get back to y'all when the phone pays another visit.
>
> Tnx,
> - Mike
>
> --
> Michael Spencer                  Nova Scotia, Canada       .~.
>                                                            /V\
> mspencer at tallships.ca                                     /( )\
> http://home.tallships.ca/mspencer/                        ^^-^^
> _______________________________________________
> nSLUG mailing list
> nSLUG at nslug.ns.ca
> http://nslug.ns.ca/mailman/listinfo/nslug


More information about the nSLUG mailing list