0

What I need:

local Router --> RPI 3 <-- wifi Router

  • local Router provides dynamic IP by Ethernet cable, but this is a local network, closed from global network.

  • wifi Router (smartphone, or any other wifi source) provides connection to global network.

  • need RPI to have IP access from local network, to be able to connect over ssh or make git pull push from local network.
  • need RPI to have access to the global network. For example, to call for github.com directly.

One of the main purposes, to be able to make export http_proxy on the linux server, to rpi, and get access to global network. Also to use github.com directly from servers, and not using lots of hucks and zip downloading.

I read around 15-20 topics on this subject, but mostly people wanted to connect rpi as a bridge or make it bypass wifi router. My case is a little more difficult i guess. Unfortunately i am not so great at understanding iptables and reconfiguring them. And I have RPI 3 here, so it is connecting to wifi without usb dongle.

btw, now I have this :

pi@raspberrypi:/etc/network $ hostname -I
10.65.1.32 192.168.43.44

one is from local network, one from wifi. but it can call only local network now.

What can be done to achieve all this?

UPD 1:

pi@raspberrypi:~ $ ifconfig -a
eth0      Link encap:Ethernet  HWaddr b8:27:eb:27:e7:d4
          inet addr:10.65.1.32  Bcast:10.65.15.255  Mask:255.255.240.0
          inet6 addr: fe80::6e5e:9bc7:afaa:90f1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16221 errors:0 dropped:4 overruns:0 frame:0
          TX packets:313 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1230262 (1.1 MiB)  TX bytes:45139 (44.0 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:210 errors:0 dropped:0 overruns:0 frame:0
          TX packets:210 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:18348 (17.9 KiB)  TX bytes:18348 (17.9 KiB)

wlan0     Link encap:Ethernet  HWaddr b8:27:eb:72:b2:81
          inet addr:192.168.43.44  Bcast:192.168.43.255  Mask:255.255.255.0
          inet6 addr: fe80::58c3:682d:6dc9:7966/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:275 errors:0 dropped:238 overruns:0 frame:0
          TX packets:209 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:80720 (78.8 KiB)  TX bytes:41904 (40.9 KiB)


pi@raspberrypi:~ $ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.65.0.1       0.0.0.0         UG    202    0        0 eth0
default         192.168.43.1    0.0.0.0         UG    303    0        0 wlan0
10.65.0.0       *               255.255.240.0   U     202    0        0 eth0
192.168.43.0    *               255.255.255.0   U     303    0        0 wlan0

pi@raspberrypi:~ $ traceroute github.com
traceroute to github.com (192.30.253.113), 30 hops max, 60 byte packets
 1  10.65.0.2 (10.65.0.2)  0.539 ms  0.489 ms  0.467 ms
 2  * * *
 3  * * *
...
28  * * *
29  * * *
30  * * *

UPD 2:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

allow-hotplug wlan1
iface wlan1 inet manual
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

UPD 3:

Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 8.0 (jessie)
Release:        8.0

OS on servers - redhat 6, desktop PC's have Linux Ubuntu 14 and Microsoft windows 7.

bumped to the homepage by Community yesterday

This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Nov 24 '16 at 13:51
  • Comments are not for extended discussion is a basic StackExchange policy. See, providing extended help in the comments is never appropriate. And extended discussions are not what this network was created for. This is a Q&A Site. – Ghanima Nov 24 '16 at 14:14
  • Again: asking for clarifications using comments is perfectly fine. Providing those clarifications via edits to the question is perfectly fine. In the end the comments that lead to this point are but superfluous and could be removed. The ado about the whole procedure on the other hand is completely unrelated to the question. – Ghanima Nov 24 '16 at 14:21
  • Being rude to another user will not improve your chances of getting an answer. Remember the first rule of StackExchange is be nice. @Ghanima is correct this type of extended back and forth should be moved to chat and the pertinent details added to the question and answer as needed. – Steve Robillard Nov 24 '16 at 16:11
0
  1. You need to make sure your default gateway is pointed to WiFi router.

    netstat -nr
    
  2. You need to make sure you have correct DNS configuration.

    cat /etc/resolv.conf
    
  • what do you mean "correct DNS configuration" ? – Altenrion Nov 24 '16 at 10:05
  • you should have an accessible dns server in /etc/resolv.conf: you should have a record "nameserver x.x.x.x" where ping x.x.x.x should work – Andy A Nov 25 '16 at 20:18
0

The thing you should carefully look at when you set dual network is metric From the routing table, it can be clearly see that whatever you search, it first search in your local network (10.65.0.0).

It seems your /etc/network/interfaces file is different than I thought, but give a try with

iface eth0 inet manual
metric 100

and

iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
metric 10

Smaller number, higher priority.

and restart network interface by

ifdown eth0 
ifdown wlan0
ifup eth0
ifup wlan0

/etc/init.d/networking restart

and check whether the metric is changed by route command and try what you are trying to do.

  • Comments are not for extended discussion; this conversation has been moved to chat. – Ghanima Nov 24 '16 at 13:56
  • Give my discussion back! – Altenrion Nov 24 '16 at 13:56
  • The thing we should have a look at is "source based routing" – Sean83 Nov 24 '16 at 14:27
  • it is easy to configure on Windows but seems it needs some modification. – Sean83 Nov 24 '16 at 14:28
  • I have Linux servers and Linux/windows PC's. what options do we have ? – Altenrion Nov 24 '16 at 14:50
0

As it is seen in your outputs, your raspi tries to access internet over LAN, not WLAN.

To make it access to internet via WLAN, just set route priorities of LAN and WLAN.

Append the following lines at the end of /etc/dhcpcd.conf file. Lower metric means higher priority. (Don't forget to reboot)

interface wlan0
metric 1

interface eth0
metric 2

But you have 2 main problems (which should be answered in other threads) to use your raspi as HTTP proxy:

  1. How to resolve domain names on computers located in LAN
  2. How to setup a proxy server on raspi
  • 1. /etc/hosts may help as there usually isn't that many LAN hosts perhaps, also lightweight DNS can be found 2. i would try cntlm (also can be used as simple proxy if you do not define parent one) or squid maybe – tomasb Feb 23 '18 at 11:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.