WiFi to Ethernet using Raspberry Pi

You can use your PI as a router to share the ethernet connection to  WiFi Devices , What about the other way ?

Here is tut for Ethernet to WiFihttp://elinux.org/RPI-Wireless-Hotspot ( This tut helped me to get idea )

Requirements

  • A Raspberry Pi, model B.
  • A boot SD card for the Raspberry Pi.
  • Connected to Networking Via WiFi
  • An Ethernet cable to connect PC

Assumes that you have connected your device via WiFi and ssh logged in using WiFi .

If wifi is not setup perfectly please see this one :

Wifi auto connect : http://blog.arevindh.com/solved-raspberry-pi-wifi-disconnect-problems.html

Instructions

1. Install the necessary software.

2. Configure DHCP. Edit the file /etc/udhcpd.conf and configure it like this:

Edit the file /etc/default/udhcpd and change the line:

to

You will need to give the Pi a static IP address with the following command:

To set this up automatically on boot, edit the file /etc/network/interfaces and replace the line “iface eth0 inet dhcp” to:

If the line “iface eth0 inet dhcp” is not present, add the above lines to the bottom of the file.

Configure Your WiFi

3. Configure NAT (Network Address Translation). First, enable IP forwarding in the kernel:

To set this up automatically on boot, edit the file /etc/sysctl.conf and add the following line to the bottom of the file:

Second, to enable NAT in the kernel, run the following commands:

Your Pi is now NAT-ing. To make this permanent so you don’t have to run the commands after each reboot, run the following command:

Now edit the file /etc/network/interfaces and add the following line to the bottom of the file:

4. Issue commands to start the dhcp server:

Your Pi should now be hosting a ethernet hotspot. To get the hotspot to start on boot, run these additional commands:

Reboot  Pi and plugin the LAN cable and you can see the auto allocated ip on command ipconfig (on windows) / ifconfig (on linux).

If you have any problems please comment Below .

Leave a Reply

Your email address will not be published. Required fields are marked *