查看: 2001|回复: 0

[教程] 【一网打尽】Raspberry Pi Course Week 2 – Day 4.0 (Networking)

[复制链接]
  • TA的每日心情
    开心
    2016-8-4 10:56
  • 签到天数: 242 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2015-3-27 15:49:00 | 显示全部楼层 |阅读模式
    分享到:

    One of the first things you will want to do with your Raspberry Pi is to connect it to a network so that you can gain access to the internet.  You will need an IP address to gain access so that any information destined for your Raspberry Pi actually gets there.  This is much like a house address.  If someone is sending you a letter then they would need to know your address for you to receive it.

    IP addresses take the form of something like this

    192.168.0.1

    Each device that has access to a network requires a unique IP address otherwise if two addresses are the same, the information will not know which device to deliver the information to.

    Most networks and out of the box routers automatically supply your Raspberry pi with an IP address.  This saves you a lot of the work when setting it up.  To connect your Raspberry Pi to the internet just plug in a network Ethernet cable.  (See Week 1 – Day 4 (Connecting it up)).

    To confirm that you have an internet connection following these instructions

    Open a terminal window

    Type

    $ ping 158.43.128.1 -c 5

    Press enter.

    This will ask a device on the internet for a reply.

    PING 158.43.128.1 (158.43.128.1) 56(84) bytes of data.

    64 bytes from 158.43.128.1: icmp_req=1 ttl=64 time=0.342 ms
    64 bytes from 158.43.128.1: icmp_req=2 ttl=64 time=0.349 ms
    64 bytes from 158.43.128.1: icmp_req=3 ttl=64 time=0.381 ms
    64 bytes from 158.43.128.1: icmp_req=4 ttl=64 time=0.355 ms
    64 bytes from 158.43.128.1: icmp_req=5 ttl=64 time=0.411 ms

    For this automatic connection to happen it uses DHCP which stands for Dynamic Host Configuration Protocol.

    Enter the following

    $ sudo cat /etc/network/interfaces

    The line that makes this happen is

    iface eth0 inet dhcp

    iface refers to interface, which is the eth0 or the port that you connected your network cable to.  The type of connection required is dhcp which configures the Raspberry pi to use DHCP or automatic IP addressing.


    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /4 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-11-19 13:24 , Processed in 0.108454 second(s), 15 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.