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?
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?
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
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.