1

I am new at raspberry and i have to do my project.

I am using my pi terminal through my laptop using cat5 cable.

everything is fine. I can ping the laptop on ssh.

Now I would use the internet on the pi.

How do I do that?

  • 1
    it's very unclear, where your laptop gets the internet connection from, what OS do you have installed on the laptop and so on. i'd suggest you connect your Pi to your router using cable or wireless USB dongle, this way it gets internet connection no matter if your laptop is around or not. – lenik Jan 25 '14 at 6:52
  • Thank you for your respond. my laptop use ubuntu 13.10 and the internet from wireless. I can't use the router because my goal is building a human sensor to finish my project. so i will have to use sharing connection – fahad Jan 26 '14 at 15:23
1

under linux if you're using internet via wifi use the IP forwarding to forward packets from ethernet to WIFI and then internet.

on your PI if you're using Raspbian edit /etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
gateway 192.168.0.1

gateway is the IP of your PC (cat5 network)

set dns server /etc/resolv.conf

if there are no internet, change the 8.8.8.8 to a dns server (search online dns server IP) ex: nameserver 82.216.111.121

on your PC set IP forwarding (edit iptable)

create a script ip_forwarding.sh

  iptables=/sbin/iptables
    iptables --flush -t nat
    iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
    iptables --append FORWARD --in-interface eth0 -j ACCEPT
    echo 1 > /proc/sys/net/ipv4/ip_forward

make this script executable chmod +x ip_forwarding.sh and run the script ./ip_forwarding.sh

0

If you are using a Windows laptop you can use Connectify. I've done it myself and it works fine.

After you start Connectify you will see Raspberry Pi as a connected device. Then you can select which connection to share etc..

However Connectify is not a free software.

  • I do have windows and I prefer to use ubuntu. But thank you for you command. I will put it on mind. – fahad Jan 26 '14 at 15:24

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.