0

I'm trying to enable internet on RPi but without success. I connected RPi to my PC (ubuntu 15.04) with ethernet cable and established ssh connection. PC have internet via wi-fi. Well, I'm not quite experienced with Linux and I'm missing something, on Windows OS it was rather easy to do. So, what's wrong?

[PC with ubuntu side]:

--------------------------------------------------
user@PC:~$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.0.1     0.0.0.0         UG    1024   0        0 wlan0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
--------------------------------------------------
user@PC:~$ sudo cat  /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.1
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.20
--------------------------------------------------
user@PC:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 54:a0:50:e6:d4:f3  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::56a0:50ff:fee6:d4f3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7802 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8527 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3229525 (3.2 MB)  TX bytes:842590 (842.5 KB)

wlan0     Link encap:Ethernet  HWaddr 00:0c:43:00:26:7f  
          inet addr:192.168.0.3  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:43ff:fe00:267f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:167397 errors:0 dropped:0 overruns:0 frame:0
          TX packets:116072 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:194197603 (194.1 MB)  TX bytes:14838195 (14.8 MB)
--------------------------------------------------

[Raspberri Pi side]:

--------------------------------------------------
pi@raspberrypi ~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
--------------------------------------------------
pi@raspberrypi ~ $ sudo cat /etc/network/interfaces
auto lo

iface lo inet loopback

auto eth0
iface eth0 inet static
    address 192.168.1.200
    netmask 255.255.255.0
    gateway 192.168.1.1

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
--------------------------------------------------
pi@raspberrypi ~ $ ifconfig 
eth0      Link encap:Ethernet  HWaddr b8:27:eb:10:15:7d  
          inet addr:192.168.1.200  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:401 errors:0 dropped:0 overruns:0 frame:0
          TX packets:393 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:34582 (33.7 KiB)  TX bytes:47600 (46.4 KiB)
--------------------------------------------------

Tried I think already everything, even enable ip4 forwarding, but had no luck for now. Any ideas?

Update:

Tried ping 8.8.8.8

[internet]<------->[WiFi router]<---wifi--->[PC]<------>[RPi]

  • Have you tried an nslookup and a ping from the rPi? From what you posted it looks like your ethernet connection (Eth0) is working fine - at least it has an IP. Why are you saying there is no network? And why are you trying both WiFi and Ethernet at the same time - is that a requirement? Finally, since the rPi has no native WiFi, which dongle/adapter are you using and does it show up when you do lsusb? – Phil B. May 4 '15 at 19:15
  • I tried to ping 8.8.8.8 from RPi but it's not working. nslookup I didn't try and frankly speaking I don't familiar with that tool. wlan0 on raspberry side was just been by default there, so I don't use wifi on RPi. If you'll find some mistake in config, please let me know – cy8g3n May 4 '15 at 19:21
  • Why does the PC have a gateway of 192.168.1.20? Does your wifi router have a rule which forwards traffic to 192.168.1.* to 192.168.0.3 (i.e. does it know that your PC handles network 192.168.1.*? – joan May 4 '15 at 19:23
  • I have no idea ) I just copied configs from some forum. No wi-fi router configured by default, so it have no idea about 192.168.1.* network. But it have connection with my PC and by idea PC should share internet with RPi, or I'm mistaken? – cy8g3n May 4 '15 at 19:28
  • Ah! Do you have your rPi plugged into your PC's ethernet port and are you expecting this to give you internet? Not likely. Can you try plugging your rPi into your router instead? That should give you network access. – Phil B. May 4 '15 at 19:41
0

I solved it and answer is here https://help.ubuntu.com/community/ShorewallBasics Basically, as I understood you need to forward the packets from one network (motherboard embedded network card in my case) to another (wifi PCI card) in your PC and mask packets for router, that he thinks that these packets are from your PC and not from another device, because router have no idea about another network.

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.