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?
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It only takes a minute to sign up.Sign up to join this community
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
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
if there are no internet, change the 18.104.22.168 to a dns server (search online dns server IP) ex:
on your PC set IP forwarding (edit iptable)
create a script
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