2

I have a Raspberry pi and I have connected it to my laptop via LAN cable in order to remote it, on the other side I want to use my WiFi to use internet.

When I connect to both of them one of them become disconnected after a while, is there any way to handle this?

If yes can I share my internet over eth0 in order to use internet in Raspberry Pi?

thanks

2 Answers 2

0

You can do this by forwarding packets from wireless card to ethernet.

Do this on your Ubuntu machine

 ifconfig wlan0 192.168.1.1 (or whatever you want)

Enable ip_forward by 

 echo 1 > /proc/sys/net/ipv4/ip_forward

Enable forwarding in IPTABLES by

 iptables -A FORWARD --in-interface eth0 -j ACCEPT

Enable NAT mode to connect to internet by

 iptables --table nat -A POSTROUTING --out-interface wlan0 -j MASQUERADE

On your RPI set IP to 192.168.1.x and gateway to 192.168.1.x (ubuntu wlan0 ip address)

You might want to invest in a USB WiFi adapter. You can find them on Amazon for as low as $7. Just search Raspberry Pi Wifi

1
  • change my RPI`s eth0 to 192.168.1.x? there is no need to change my laptops eth0?
    – Yashar
    Jan 27, 2015 at 5:05
0

You can access internet via wlan0 and share it eth0. Don't need to do any changes. Just share eth0 over wlan0.

You can access rpi and surf internet.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .