Page 1 of 1

How do I set wlan0 to internet and eth0 to local network?

Posted: Tue Nov 01, 2016 1:02 am
by OrangeJello
I have two Pi's that are connected together through a switch as part of a local intranet where each Pi is assigned a static IP for their eth0 interface.

But in order to still be able to update packages, i wanted to set up each Pi's wlan0 interface so that it connects to my home Wifi and can have access to the internet.

I modified /etc/dhcpcd.conf for both as follows:

Code: Select all

#set static ip for eth0
interface eth0
static ip_address=192.168.50.101/24
static routers=192.168.50.1
static domain_name_servers=192.168.50.1
Then I modified /etc/wpa_supplicant/wpa_supplicant.conf for both to include the SSID and PW for my home Wifi. Everything seems to be connected because when I 'ifconfig', I get:

Code: Select all

eth0       
          inet addr:192.168.50.101  Bcast:192.168.50.255  Mask:255.255.255.0
          inet6 addr: fe80::6834:a300:6140:934f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4592 errors:0 dropped:1305 overruns:0 frame:0
          TX packets:3787 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:292917 (286.0 KiB)  TX bytes:617701 (603.2 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:504 errors:0 dropped:0 overruns:0 frame:0
          TX packets:504 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:46488 (45.3 KiB)  TX bytes:46488 (45.3 KiB)

wlan0     Link encap:Ethernet  
          inet addr:10.118.7.80  Bcast:10.118.7.255  Mask:255.255.254.0
          inet6 addr: fe80::8481:9cd6:a20b:6daa/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3123 errors:0 dropped:3080 overruns:0 frame:0
          TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:693307 (677.0 KiB)  TX bytes:7304 (7.1 KiB)
But when I actually try to apt-get or ping anything on the internet, there doesn't seem to be an actual connection. Am I missing something here? Can I actually separate wlan0 and eth0 onto two separate networks or do they get bridged automatically?

Re: How do I set wlan0 to internet and eth0 to local network

Posted: Thu Nov 03, 2016 4:29 pm
by DougieLawson
You've got your gateway router defined on your eth0 interface. Remove that "static_routers" line it should only appear on the interface that's connected to the public internet.