element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
Clem Martins's Blog Networking 101 and Raspberry Pi 2
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: clem57
  • Date Created: 8 Mar 2015 10:58 PM Date Created
  • Views 2445 views
  • Likes 5 likes
  • Comments 17 comments
  • windows_7
  • rpiintermediate
  • putty
  • ssh
  • raspberry-pi
Related
Recommended

Networking 101 and Raspberry Pi 2

clem57
clem57
8 Mar 2015

So Why Networking and new Pi 2?

 

Introduction

 

  I have been seeing many discussions lately involving the Raspberry Pi 2 from new users. Many wish to use the new credit card sized computer with a lot of power, but cannot dedicate the resources like HDMI monitor, keyboard, mouse, etc. So what to do? If you learn a bit about networking, I can show you a way to use this small sized computer without the expense of these and keep the wife and kids happy because you do not steal the TV! So lets get into a little fun learning and see the results.

 

Networking

 

  So you may have heard the word or something like TCP/IP and thought this was too complicated or feared a lot of math. Let me say I will not use anything more than arithmetic! Stay with me and I will show how to see this picture:

 

image0.jpg

  The picture on the right says a thousand words! But you really need to understand just a few.  The bottom layer is the actual physical connections like RJ45 plug used with Cat5 cabling. We all have used this when we hook up the laptop to a physical device called a router. If we use the wireless, it is replaced with an adapter like USB or on the motherboard with an internal antenna. But whatever it is it is "PHYSICAL". The next layer up is Data Link using a MAC address normally burned into hardware. Think of this as a device address since you may have both wireless and wired connection on the same machine.

  Ok, moving up to layer 4 we see the transport. This layer handles "HOWTO" communicate between devices. There are two choices: 1) UDP where I send a message and expect no reply. Think of email. We send an email and do not care when it arrives. But if we care, we use 2) TCP. TCP is like a phone call. I will only talk when I get someone on the other end. How do I know? They say "Hello"! Once I know who they are, we take turns back and forth talking waiting till the other pauses before talking. This is TCP and sometimes called Half Duplex! BTW, this is how we talk with the router. We use another address called IP at this level. But I need another part called the mask also. So communication is from computer to router. Then the router relays the message to other routers. The last part is a router to a computer known as the server. Google has many servers and so do other companies.

  The next two layers only happen on the computers and not in the routers. They do various things like encrypt messages using SSL. If you see an url with HTTPS, that is using SSL. You would not want to send bank information if not HTTPS. Some browsers also add a symbol in the corner looking like a lock closed! Good to check your browser.Sockets is another part referring to the application handling of the commands to "send" or "receive" data. The server uses a special command called "listen" to see if anyone wants some help or service. On the very top are the protocols. These are FTP (file transfers), SMTP (sending email), POP3, (receiving email), Telnet (application terminal like SSH), and SNMP (signalling information for errors over the network).

 

For more details see OSI networking model, TCP/IP | What’s The Difference Between… content from Electronic Design

 

Raspberry Pi 2

 

  So why do I care? When I know the networking above, I can connect my Raspberry Pi directly to my laptop without a router like magic. After following an install of Rasbian (there are many places to show how, see Downloads | Raspberry Pi for latest downloads), we are ready to setup the Raspberry Pi 2. First using nano on the Pi, we need to change this file (be careful not to delete):


image  sudo nano /etc/network/interfaces

 

#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.5.90
netmask 255.255.255.0
# The above sets a static IP address and mask to allow direct connection to Windows 7 laptop

 

image  Note the address uses a 5 in the third position after the second dot. You can use anything from 2 to 255 as long as it it NOT used by your router! because 0 and 1 are often used...

 

image  sudo apt-get update


image  sudo apt-get upgrade


image  sudo apt-get install tightvncserver


image  Note you may need to reply "y" for the above to continue.

  Next, with both machines off, cable the ethernet on the Raspberry Pi 2 with a cat5 cable to the ethernet on the laptop/desktop Windows 7 machine. Turn on the Raspberry Pi 2 and the laptop/desktop Windows machines. after a few minutes time, both should be up. If you can tell me below which came up first. image Open Network and Sharing Center on Windows 7. You should see on the second line (if you using wireless!) an unidentified network. To the right, click on Local Network Connection after the Connections:

At the bottom left, click on the Properties button. In new popup, looking down the list of protocols (remember those?) we want to select (not open) Internet Protocol Version 4 (not 6 since that is newer!). The Properties button becomes available on the right below list. Please click it now. In this box (love how Windows uses many boxes?), change from "Obtain an IP address automatically" to "Use the following IP address". See below what to enter:

 

192 . 168 . 5 . 89
255 . 255 . 255 . 0
  .    .    .
First is IP address, second is mask, and third is gateway which is left blank since we do not use a router.

 

  Lastly we need software to talk to Raspberry Pi 2 from Windows 7. I would suggest PUTTY, but any would do. See Download PuTTY - a free SSH and telnet client for Windows.

Now we can configure PUTTY with these parms:

Host:      pi@192.168.5.89        Port:    22    image SSH      Saved Sessions:    My RaspPi 2

Click button "Save" these parm as your favorite name(My RaspPi 2). Click "Open" button near right bottom to open a terminal window. You will enter the default password of "raspberry" . Now you have a one line terminal interface. But wait, you want a full screen like on a monitor!

 

Window 7

 

  We are almost there so stay with me. In order to run full screen, we need a VNC server and a VNC client. The server code was downloaded before when we installed tightvnc server code. It is the most widely used because it is small foot print in memory and fairly responsive. To start, we will need our SSH window into Raspberry Pi 2. Look above if you need to re open. Enter the following:

image    tightvncserve :1


image    You will be prompted for a password. This is not the Raspberry Pi 2 password, but one you will use below for client connection. It is 8 characters in length.

 

image     Repeat exactly what you typed in previous set to verify.

 

image     Another password for view only. I hit enter to skip!

 

image     You will get a few lines showing you are done. Save these by selecting and copy. Later paste into a safe place in case you need them.


    This command will start a background program to "listen" for any attempt to run VNC service on port 5009. If this sounds strange please re-read the networking above. Next step we can download on Windows 7 a program called UltraVNC. You can find a download at UltraVNC | SourceForge.net. Read very carefully before downloading so you understand the process. When we open the UltraVNC Viewer on Windows 7, we get a small window:


image    VNC Server: 192.168.5.90:1


image    Click Connect button on right side


image    A window prompting you for password:


image      This is the password you set for TIGHTVNC SERVER and not the Raspberry Pi 2 password!


image    See new window open looking like this:


image


     Well thats all for now. If you like this tutorial please like. Any comments or correction are appreciated as well. Ciao!

  • Sign in to reply

Top Comments

  • clem57
    clem57 over 10 years ago in reply to Former Member +2
    The purpose was a challenge. This desktop is Linux! LOL
  • Former Member
    Former Member over 10 years ago +1
    HI @clem57, Thank for sharing this. I'd PM you but haven't figured out how to do that yet. Just some small typos - "phone care" instead of "phone call" up at the beginning in the OSI model description…
  • johnbeetem
    johnbeetem over 10 years ago in reply to clem57 +1
    Clem Martins wrote: Any standard ethernet cable will work. The physical connections have a circuit to reverse the signals when necessary. Funny thing but I have not needed a patch for a long time.…
  • clem57
    clem57 over 10 years ago in reply to waholi

    Thanks for your comment.

    Clem

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • waholi
    waholi over 10 years ago

    nice i liked it easy to follow image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    Cool

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago in reply to Former Member

    I could do a `remmina` write-up for targeting other XRDP hosts that I work with but some subtlety of the Raspbian desktop (Debian + LightDM + MATE) might get missed.  I'll do a remmina write-up if no one else has after my house gets reorganized and I can entertain yet another hardware project i.e. Raspberry Pi 2.  See http://www.raspbian.org/RaspbianMate for a good write-up on how to get started with Raspbian MATE.  I would suggest LightDM as the desktop manager layer since besides being light weight, it has stood the test of time as the standard for Xubuntu (my desktop of preference in large-ish computers so I eat the cake that I make!).

     

    Regarding `scp` ("WINSCP", Clem mentioned), I am confident that Raspbian readily supports both remote client `scp` (via the ssh daemon) for batch data copying and remote client `ssh` for command-line interactivity.  I also saw that Raspbian support plain and secure forms of ftp.  For detailed package support, see the contents list at http://archive.raspbian.org/raspbian/dists/stable/main/.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • johnbeetem
    johnbeetem over 10 years ago in reply to clem57

    Clem Martins wrote:

     

    Any standard ethernet cable will work. The physical connections have a circuit to reverse the signals when necessary. Funny thing but I have not needed a patch for a long time.

    Most Ethernet ports nowadays (including RasPi) have Auto MDIX.  The port automatically switches the transmit and receive pairs and figures out which way works.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube