For networking we require an ethernet crossover cable. (Some say that pi does automatic crossover and hence straight cable is sufficient, however, I haven't checked it yet.)
First connect both the machines with the ethernet cable, then make a note of windows
IP address and
Subnet Mask. This is essential, because, the static IP that we assign to the pi should be in the same subnet. Though this is obvious, most of the time people forget it (as I did) and assign IP under different subnet; which will never work without a switch, hub or router. Alternatively, both windows IP and pi's IP could be manually configured with same subnet. However since windows assign an IP automatically, it is sufficient to configure only the pi.
Fine, in my case, following is my windows IP configuration.
Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : Autoconfiguration IPv4 Address. . : 169.254.253.161 Subnet Mask . . . . . . . . . . . : 255.255.0.0 Default Gateway . . . . . . . . . :
So, accordingly configure pi. Edit the interface file
/etc/network/interfaces and make sure the following content is fed.
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 169.254.253.162 netmask 255.255.0.0
Restart the network
$ sudo /etc/init.d/networking restart and ensure the settings are reflected. Also, check if the SSH server is enabled, else enable it.
Thats it. On windows use PuTTY to establish the SSH connection with pi.
I'm now working on sharing internet from Windows to Pi.