Posts: 28
Joined: Mon Jul 02, 2012 9:19 pm

Raspberry PI on the move

Thu Jul 05, 2012 8:48 pm

OK I got my Raspberry working OK on the TV but sometimes I want to use my Raspberry out of the house, e.g. I.d like to use my Raspberry on the train thru my laptop.
Now to achieve this I bought a 6" USB cable for power and made up a 6" ethernet cable so now I'm typing on my laptop with the raspberry attached.
To get access to my Raspberry currently I gave it a fixed IP address which I put in my windows host file, enabled sshd on the PI and installed a handy app on my laptop called MobaXterm. So I can ssh to pi@raspberry and get a terminal session that I can start gui apps like xclock gparted etc from which is all well and good.
Now on my windows laptop I have virtualbox installed with various linux images and without me having to do anything really when I installed virtual box it seems to have configured a virtual nic and IP forwarding so I can access the net from these virtual images. Now what I want to do is the same thing from my raspberry.
So I have the raspberry on o private network including only 2 devices, laptop and Raspberry, and I have the laptop connected through wifi to a router or to the internet though a mobile internet usb stick.
I want to configure my PC to forward traffic between the Raspberry and the Net.
Anyone know best way to do this other than running a linux laptop. This obviously involves work on the laptop not the Raspberry. Networking and Microsoft products arent my strong points.

Posts: 5
Joined: Sun Jun 17, 2012 10:23 am

Re: Raspberry PI on the move

Thu Jul 05, 2012 9:36 pm

You need to do an internet search for windows internet connection sharing. Basically its a way for your laptop to share its network connection. Typically your laptop connects wirelessly to your router and the ethernet port connects to your Rpi. With connection sharing set up in windows, then windows will provide an IP address via DHCP to your Rpi and set up it's routing to forward any network packets it receives from/to your Rpi. You will need to ensure that your Rpi is configured to NOT have a static IP address which is the case by default so you should be OK if you haven't changed anything from the default network settings.

Posts: 28
Joined: Mon Jul 02, 2012 9:19 pm

Re: Raspberry PI on the move

Fri Jul 06, 2012 11:27 pm

Internet connection sharing. - Realize what I did wrong now, I needed to alter the sharing options on the wireless connection to my router not on the ethernet connection between PI and laptop.
So in windows Network sharing centre , I double click my wireless connection, go to properties and then sharing.I tick the top box and in the box below my local ethernet network (PI), leave the second tick box and the other stuff well alone.

DHCP. Although I can likely predict the IP address that might be allocated Id rather use a fixed IP.
I mean the only way Im connecting to the PI is over the network so I should give it a fixed IP.

I edited my windows hosts file and added an entry called raspberrypi with the fixed IP address I wanted to use.

On the PI I set my /etc/resolv.conf with the one line:

Edited my /etc/network/interface file which now looks like
auto lo
iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static

Where my router private network is and my pi private network is
rebooted, logged on thru mobaxterm,

tried ping , bingo
echo $DISPLAY its set to localhost:10.0
tried xclock xedit gparted bingo bingo bingo
tried startx, hmm no joy, not exporting like xclock etc, but so long as the x commands I need to use are working that will do for now.

Posts: 28
Joined: Mon Jul 02, 2012 9:19 pm

Re: Raspberry PI on the move

Sat Jul 07, 2012 11:23 am

Worth noting,

If you do use DHCP instead of a static IP, Rasp PI DHCP client will recreate your RASP PI resolve.conf file on reboot, setting the gateway as the nameserver,
If you are not connecting the Rasp PI directly to a router you would probably still want your router to be your nameserver.

so if you use DHCP, ie in your /etc/network/interfaces you have:

iface eth0 inet dhcp

and you connect your Rasp PI to your computer on one network and your computer to the net on another network linking the 2 with windows ICS

Its worth editing the dhcp config:
vi /etc/dhcp/dhclient.conf

add this at the bottom (where is your router IP:

interface "eth0" {
prepend domain-name-servers;

Now the resolve.conf will still be recreated but in addition to any other potential nameservers will be checked first.

Also it seems Windows 7 ICS defaults for a local area connection connected to another which is "This computers internet connection" and allocates to the first connected device after taking for its self . Remove the ICS connection and the local network (or as windows would call it public) default is something else. 169.254.? well something else anyway. Sure from windows these can probably be changed although allocating IPs based on MAC address dont know how you can simply do that in Windows?

I should also add:
The local network between PI and Laptop on from laptop running Windows 7 is shown as PUBLIC and does not allow changing to HOME or WORK which are other windows terms. This is annoying. Seems because Windows 7 will only allow HOME or WORK where it detects a DHCP server on that subnet. I don't really want to run a DHCP server on the Rasp PI. Not sure if this will cause any problem yet.

Also finally:

If powering the Rasp PI from a USB on laptop or computer which I would like to I get occasional problems with network connection and stuff crashing which don't happen using a 700ma PSU
I guess a regular PC USB only powers to around 500ma which is a little low.
Wonder if there's a way to reduce power consumption if not using the HDMI port??

Return to “Beginners”

Who is online

Users browsing this forum: Bing [Bot], pcmanbob and 39 guests