NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Strange occurrences with my Pi.

Fri May 31, 2013 6:06 am

For starters, my Pi is a 100% stock install. I've yet to get the thing networked to anything, so there have been no updates to it.

Frustrated that I still can't figure out how to network my Pi to my other Linux desktop I start trying some new things.

I've got my Pi connected to my Debian desktop via an ethernet cable, though there is no connection there. Can't figure out how to get them connected. Okay, no big deal. I don't have a USB hub but I do have a USB Wi-Fi adapter. Maybe I'll just boot up the Pi, and be able to unplug my mouse so I can just manage the pi via my keyboard and be able to get connected to the net so I can do something (anything) with my Pi. As soon as I unplug my mouse, my keyboard dies. It just won't work. Plug mouse back in? Keyboard works.

I've tried a various different combinations of utilizing the two USB ports after being booted up so I can connect somehow, with no luck. If I unplug the keyboard with just the mouse plugged in, and then plugin the USB Wi-Fi adapater, the Pi reboots. Crap. So now I unplug the mouse and plugin the keyboard while booting up, but alas, keyboard doesn't work. AHH!

So, so far I've got a stock Pi. I can't quite figure out how to network it via ethernet to my Debian PC that is connected to the internet, and I can't get the Pi connected to the internet via the USB wifi adapter.

Any idea on how I can do something with this? I don't really want to buy a USB hub as once I get this setup properly I won't need a mouse/keyboard plugged in and it will simply be connected via my debian PC via ethernet. I'd hate to buy one just to use it for an afternoon.

Thanks!

User avatar
RaTTuS
Posts: 10456
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 6:21 am

connect it direct to your router,
you need no mouse anyway
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 6:31 am

RaTTuS wrote:connect it direct to your router,
you need no mouse anyway
Is this the only way? I have no direct access to my router, and if I did, I'd not know any information for it.

I simply have a USB wifi adapater for my PC, and I know the network name/password. That's all.

Am I SOL?

User avatar
RaTTuS
Posts: 10456
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 6:37 am

run a dhcp server on your desktop
plug the a NIC lead from desktop to RPI [no need for mouse or keyboard on the rpi ]
power the RPi
and look in your desktop dhcp logs
you then can ssh into it
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 6:41 am

You could give the Pi and your (Linux?) laptop dedicated IP addresses so that they can talk to each other.

On your laptop do

sudo ifconfig eth0 192.168.4.1

On your Pi do

sudo ifconfig eth0 192.168.4.2

You should then be able to ping and ssh between them.

If your laptop has a wireless connection to the outside world you could also add (on your laptop)

Where router is the hostname or the ip address of your router.

sudo route del router
sudo route del default
sudo route add -net router netmask 255.255.255.255 dev wlan0
sudo route add default gw router
sudo sysctl -w net.ipv4.ip_forward=1


Edited to add: This should allow your Pi to access the internet via your laptop.
Last edited by joan on Fri May 31, 2013 7:36 am, edited 1 time in total.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:30 am

joan wrote:You could give the Pi and your (Linux?) laptop dedicated IP addresses so that they can talk to each other.

On your laptop do

sudo ifconfig eth0 192.168.4.1

On your Pi do

sudo ifconfig eth0 192.168.4.2

You should then be able to ping and ssh between them.
Great! I can now ping my PC from the Pi and connect to the Pi via SSH!

New problem though, once I connect to the Pi via SSH I'm locked. I can't type anything in the terminal.

Code: Select all

~$ ssh pi@192.168.4.2
The authenticity of host '192.168.4.2 (192.168.4.2)' can't be established.
ECDSA key fingerprint is d0:67:52:ec:61:47:d4:0e:c1:f9:0f:dc:03:85:5e:f1.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.4.2' (ECDSA) to the list of known hosts.
pi@192.168.4.2's password: 
Linux raspberrypi 3.6.11+ #371 PREEMPT Thu Feb 7 16:31:35 GMT 2013 armv6l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Feb  9 12:17:28 2013
pi@raspberrypi ~ $ 
Opening a terminal on the Pi and issuing the 'who' command shows I'm connected. Just strange that I can't type in the terminal on my PC to issue commands to the Pi.

We're making progress though! :D

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:34 am

NightHawk wrote:...
Opening a terminal on the Pi and issuing the 'who' command shows I'm connected. Just strange that I can't type in the terminal on my PC to issue commands to the Pi.
...
Bizarre, I have no idea what's happening to cause that.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:35 am

joan wrote:If your laptop has a wireless connection to the outside world you could also add (on your laptop)

Where router is the hostname or the ip address of your router.
Since I have no physical access to the router, and only know the name of the network I connect to, the password to connect, and the mac address... How could I discover the hostname/IP of my router?

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:39 am

I should know, but I don't. Try

cat /etc/resolv.conf

If there is a nameserver entry that's probably your router's IP address.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:44 am

joan wrote:
NightHawk wrote:...
Opening a terminal on the Pi and issuing the 'who' command shows I'm connected. Just strange that I can't type in the terminal on my PC to issue commands to the Pi.
...
Bizarre, I have no idea what's happening to cause that.
Even stranger now is I can't connect via SSH or ping back and forth anymore.

Code: Select all

~$ ssh pi@192.168.4.2
ssh: connect to host 192.168.4.2 port 22: Connection timed out
Simply redid what I did before and they can communicate back and forth. I haven't tested SSHing into the 'pi' user, but added a new user on the Pi and can SSH and issue commands without issue now.


EDIT: Spoke too soon. I was able to connect via SSH to the Pi, was able to issue a single command but now I can't issue any more commands. Furthermore I can't ping my PC again from my Pi as it says 'Destination Host Unreachable'. Only way to fix this is to continually re-enter the 'ifconfig' commands.

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:51 am

Sounds a bit flaky. My wireless Pi connection is a bit hit and miss (long pauses every 5-10 minutes or so) but I've found wired connections to be rock solid.

By the way the "proper" way to get them talking is to set up a DHCP server on your laptop as RaTTuS suggested. What I suggested is more of a quick let's see if it works.

I use a DHCP server called dnsmasq.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:55 am

joan wrote:I should know, but I don't. Try

cat /etc/resolv.conf

If there is a nameserver entry that's probably your router's IP address.

Code: Select all

~$ cat /etc/resolv.conf
# Generated by NetworkManager
domain XXXXX.XXXXXXXX.net
search XXXXX.XXXXXXXX.net
nameserver 208.38.XXX.X
nameserver 184.170.XXX.XXX
nameserver 192.168.1.1
So, I assume the last one? The first two are resolvable to servers located in my state. Last one is a local one.

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:56 am

NightHawk wrote:...
EDIT: Spoke too soon. I was able to connect via SSH to the Pi, was able to issue a single command but now I can't issue any more commands. Furthermore I can't ping my PC again from my Pi as it says 'Destination Host Unreachable'. Only way to fix this is to continually re-enter the 'ifconfig' commands.
Could you see what

sudo ifconfig eth0

reports when the link fails?

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 7:57 am

NightHawk wrote:

Code: Select all

~$ cat /etc/resolv.conf
# Generated by NetworkManager
domain XXXXX.XXXXXXXX.net
search XXXXX.XXXXXXXX.net
nameserver 208.38.XXX.X
nameserver 184.170.XXX.XXX
nameserver 192.168.1.1
So, I assume the last one? The first two are resolvable to servers located in my state. Last one is a local one.
Yes, that's your router.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 8:05 am

joan wrote:
NightHawk wrote:...
EDIT: Spoke too soon. I was able to connect via SSH to the Pi, was able to issue a single command but now I can't issue any more commands. Furthermore I can't ping my PC again from my Pi as it says 'Destination Host Unreachable'. Only way to fix this is to continually re-enter the 'ifconfig' commands.
Could you see what

sudo ifconfig eth0

reports when the link fails?

Code: Select all

~$ sudo ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:21:85:62:24:c0  
          inet6 addr: fe80::221:85ff:fe62:24c0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:623 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1316 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:78382 (76.5 KiB)  TX bytes:216107 (211.0 KiB)
          Interrupt:40 Base address:0xe000 


NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 8:40 am

FML.

Tonight I learned that standard CAT5 cable =/= Crossover cable. They're completely different things. Probably why things are fudging up between the PC and the PI?

SIGHS

I'll order one :)

User avatar
rpdom
Posts: 15178
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Strange occurrences with my Pi.

Fri May 31, 2013 9:01 am

You shouldn't need a crossover cable to connect a Pi to a PC, the interface on the Pi is auto-sensing and will handle the cross-over if needed. Standard Cat5 (or better) cable is ok.

It looks to me like eth0 on the Pi (or is that the PC?) is losing its config at some point. This is strange if you have given it a static address. Maybe something else is trying to control it? Network manager and ifplugd are two possibilities that come to mind.

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Strange occurrences with my Pi.

Fri May 31, 2013 11:11 am

I can confirm you don't need a crossover cable with a Pi, it will sort itself out, the other end and be an old fixed port or a newer autosensing one, it doesn't matter. The only case you'd need a crossover was if neither end could autosense. and since the Pi can, you don't. You wouldn't have connected at all if the cable was wrong, the keyboard not working is a seperate issue.
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Fri May 31, 2013 6:03 pm

rpdom wrote:You shouldn't need a crossover cable to connect a Pi to a PC, the interface on the Pi is auto-sensing and will handle the cross-over if needed. Standard Cat5 (or better) cable is ok.

It looks to me like eth0 on the Pi (or is that the PC?) is losing its config at some point. This is strange if you have given it a static address. Maybe something else is trying to control it? Network manager and ifplugd are two possibilities that come to mind.
Ok, great. Cancelled the Amazon order as it'd be Monday before I'd get the cable anyways.

The eth0 output posted when requested was from the PC.

I'm laying in bed with the laptop now, will go fiddle with the PC and Pi soon. =]

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Sun Jun 02, 2013 1:21 am

joan wrote: If your laptop has a wireless connection to the outside world you could also add (on your laptop)

Where router is the hostname or the ip address of your router.

sudo route del router
sudo route del default
sudo route add -net router netmask 255.255.255.255 dev wlan0
sudo route add default gw router
sudo sysctl -w net.ipv4.ip_forward=1


Edited to add: This should allow your Pi to access the internet via your laptop.

Code: Select all

nighthawk@crunchbang:~$ sudo route del 192.168.1.1
nighthawk@crunchbang:~$ sudo route del default
nighthawk@crunchbang:~$ sudo route add -net 192.168.1.1 netmask 255.255.255.255 dev wlan0
nighthawk@crunchbang:~$ sudo route add default gw 192.168.1.1
nighthawk@crunchbang:~$ sudo sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1
Strange, I've gotten no errors yet my Pi still can't connect to the net. I can ping the PC, both ways, so the Pi can communicate with it, but this didn't seem to solve the sharing of net.

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Sun Jun 02, 2013 8:06 am

All I can suggest is you post the result of

sudo route on your laptop.

My network knowledge is limited to my immediate needs so I know just enough to talk between my machines.

NightHawk
Posts: 22
Joined: Thu May 30, 2013 4:27 am

Re: Strange occurrences with my Pi.

Mon Jun 03, 2013 1:31 am

joan wrote:All I can suggest is you post the result of

sudo route on your laptop.

My network knowledge is limited to my immediate needs so I know just enough to talk between my machines.

Code: Select all

~$ sudo route
[sudo] password for nighthawk: 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 wlan0
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
192.168.1.1     *               255.255.255.255 UH    0      0        0 wlan0

User avatar
joan
Posts: 14256
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Strange occurrences with my Pi.

Mon Jun 03, 2013 7:49 am

We need someone who understands route tables now. From the table you posted there doesn't seem to be a route to the Pi. i.e. I'd expect an entry such as

192.168.4.0 * 255.255.255.0 U 0 0 0 eth0

To go from your laptop to your Pi.

Actually your router also needs a route adding to know that requests for the 192.168.4.* net should be passed on to your laptop.

That may be a show stopper as you don't control the router.

Really need input from someone who understands networks.

User avatar
rpdom
Posts: 15178
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Strange occurrences with my Pi.

Mon Jun 03, 2013 8:38 am

I'm a bit fuzzy on ip forwarding and internet connection sharing and all that, but I did once do it on a Linux box using network bridging.

I had to install some bridging software and add some entries to my /etc/network/interfaces. I had eth0 and wlan0 set up as well as a virtual interface called br0. This set up eth0 and wlan0 with the same IP address and forwarded everything between them.

Essentially my PC was acting as a network switch with two ports, so I didn't need to do anything else for port forwarding.

If I remember correctly, my test system was able to use DHCP to get an IP address and everything needed for internet access from my router through my PC.

There are some instructions here http://wiki.debian.org/BridgeNetworkConnections

Return to “Beginners”