First off, I couldn’t create a bridge between Ethernet and my WiFi. So I am goin’ to tell you how I got internet using Internet Connection Sharing and Crossover Cable.
- In order to SSH to the RPi you need to set an IP address in your
subnet in the RPi by editing the /boot/cmdline.txt file
- Share Internet in your windows Machine and take note of the Ethernet IP.
- SSH into the RPi and change IP to static in same subnet and add
DNS(if it not already there) and Change the cmdline.txt to its
- Ping to see if it works
Changing the cmdline.txt according to the Machine Subnet:
Before we power up our Raspberry Pi, we can have a look at the network
settings of the computer we are planning on connecting to and
determine if the address is automatically allocated or fixed.
Hopefully, the IP Address will be set to “Obtain an IP address
automatically”. If not don’t worry, just take a note of the IP
address and Subnet Mask set here or you can change this setting to
Setting the Raspberry Pi’s IP address
Edit your cmdline.txt file: You can edit it directly on the Raspberry
$ sudo nano /boot/cmdline.txt
Or use an SD-Card reader on your computer (the file is in the root of
the visible partition on the card – if you aren’t using NOOBS).
You will need to add the ip=x.x.x.x value to the end of the line
(ensure you do not add any extra lines).
It is recommended you use a Linux compatible editor such as Notepad++
(http://notepad-plus-plus.org/) to make the change.
For network settings where the IP address is obtained automatically,
use an address in the range 169.254.X.X (169.254.0.0 –
For network settings where the IP address is fixed, use an address
which matches the laptop/computers address except the last one
(assuming your netmask is at least 255.255.255.0 / 255.255.0.0).
Ensure you take note of this IP address (you will need it every time
you want to directly connect to the Raspberry Pi, although you might
be able to use the hostname).
Share Internet in your windows Machine and take note of the IP
From Network Setting in your computer open Change Adapter settings and Open the properties of the adapter providing you with internet (in my case my WiFi adapter)
Click sharing and Check the “Allow other users to connect through this computers Internet Connection” and if there is a Drop Down Box Select the Wired Adapter (my case Ethernet)
Now, again check the IP address of the Wired Adapter (Ethernet in my case) and take note of the ip and subnet
SSH in the RPi and Change Interface Settings
Rpi can't get dynamic IP address from your Windows7 laptop, because
there are no DHCP server running on Windows 7. You have to set static
IP address on Rpi which is in same network with Windows7 laptop.
Step by step instructions. 1) Connect your Windows7 laptop to network
via wireless ethernet adapter. Note the IP address. (Let's say its
2) Give a static IP address to Windows7 wired ethernet adapter. This
IP address should be on different subnet than wireless adapter. (Let's
say it should be 10.0.0.10)
3) If you haven't monitor or TV that connected to Rpi, you should
connect Rpi to your router temporarily to set static IP address on it.
Let's say it should be 10.0.0.20)
Connect Rpi to your router through wired ethernet, Login as root or
use sudo to change IP address settings, Edit /etc/network/interfaces
file as root, Your /etc/network/interfaces file should look like this,
iface eth0 inet static
network 10.0.0.0 //I didn't enter this line
broadcast 10.0.0.255 //I didn't enter this line
And also you have to edit /etc/resolv.conf file to add nameservers for
Rpi. Remove all lines in the file and append line below.
After doing that run /etc/init.d/networking restart command or reboot
your Rpi. After setting up unplug Rpi from router than plug it into
Windows7 wired ethernet. At this step you can try ping the Rpi from
Windows7. If it pings everything is ready.
4) Bridge wired and wireless adapters in Windows7.
5) SSH into Rpi from Windows7 and test if Rpi connects to internet.
Now change the /boot/cmdline.txt to it's previous version, i.e remove ip=xx.xx.xx.xx part