Tue Nov 20, 2012 12:21 am
It depends a little bit on how you are working with your computers and the network really. And if you do something wrong, you run the risk of not being able to connect to your RPi again in an easy way. If you have a monitor and keyboard connected, it is no problem really, but if you only run your RPi headless as I do, it can be inconvenient at best :)
If your computer and your RPi are not on any other network connection but a single wired Ethernet connection you can just do the following. If either computer is also connected to a network via a second interface like wifi, you need to do an extra step I explain below.
You will need to edit your /etc/network/interfaces file on the RPi and change the eth0 entry to look something like this:
iface eth0 inet static
address 192.168.5.10
netmask 255.255.255.0
network 192.168.5.0
broadcast 192.168.5.255
gateway 192.168.5.1
Then do this whole command, you will probably lose connection to your RPi depending on your network set up. Make sure you type in the whole line, if you only do the first part, your network will not come back up without a restart of the RPi. If there is any mistake in your interfaces file, your RPi might not connect to the network at all:
sudo ifdown eth0 && sudo ifup eth0
Then on your windows pc you will need to config the IPv4 entry for your wired Ethernet connection. Set it to manually configure and give the windows machine all the same entries EXCEPT for the address entry, make that is something like:
192.168.5.11
Just change the last set of digits on the windows pc to be something other than the address you gave the RPi.
If your windows pc (or your RPi) is also connected to a network via a different interface like wifi, you will want to make sure the dummy network info and addresses does not conflict with the real network. That is why the 3rd number in the IP addresses is 5, typically home networks will be 192.168.1.0 or 192.168.0.0, so we are using 192.168.5.0 here which should avoid any conflicts, but obviously you should check first if you are also connected to another network at the same time as your direction connection to the RPi.
That should do it for a direct utp cable connection between the computer and the RPi. Your teacher is right, almost everything current is auto-sensing so you no longer need a cross over cable. I am told the RPi is auto-sensing and you only need one side of the connection to be auto-sensing, so you should be good to go.