官术网_书友最值得收藏!

Local Area Network (LAN)

Using the standard Raspbian package, both essential and non-essential drivers are included. All essential drivers are loaded and some non-essential ones are as well.

We will start by plugging in a network cable between the Raspberry Pi and the router provided by your ISP. By default, your router has a DHCP server that automatically assigns an IP address to your Raspberry Pi.

You may also use network switches to make a more complex network but because the Raspberry Pi has a 100 megabit network port, it may downgrade your entire network to 100 megabits. Some switches can negotiate separate connections to lower speed interfaces without downgrading the entire network, but you need to consult the specifications of the device in order to do this.

To check whether your LAN is up and running, just type ifconfig, and you will get text containing your current settings:

Local Area Network (LAN)

Let's try to understand the different keywords from the preceding output:

  • HWaddr: This is your Pi's MAC address, which identifies a vendor and should ideally provide a globally unique address.
  • inet addr: This is your current LAN IP address, which belongs to a private range of either 10.x.y.z (Class A), 172.16.y.x (Class B), or 192.168.x.x (Class C). They are known as private addresses because they do not exist on the Internet.
  • Bcast: This is a reserved address that's calculated by your network mask, and it transmits global messages within your private network.
  • Mask: This is used in all networks but should only be concerned with advanced configurations. Masks divide a network into subnet works and depend on the class your network belongs to.
  • inet6 addr: This is your IPv6 address. It will show only if your router supports this, but it is more difficult to remember.
  • RX: This shows how many packets have been received.
  • TX: This shows how many packets have been sent.

The eth0 port

The Raspberry Pi will typically use eth0 as its on-board LAN interface. If you add USB LAN devices, they will have an incremented number after eth; this will increment the interface number.

The wlan0 interface

When we add a wireless adapter, ifconfig will represent these interfaces using wlan instead of the eth prefix. All the details are the same, but it helps to visually identify wired networks from wireless ones.

The loopback (LO) interface

This is known as the home address because it refers to the local device and has a reserved range starting from 127.0.0.1 and ending at 127.255.255.254. This is a virtual interface that bypasses local hardware interfaces and rules. It is commonly used for security reasons and during software testing. For example, you may only allow the root access of MySQL to a localhost (this will include 127.0.0.1 for IPv4 or ::1 for IPv6). This means that only the user or service on the computer will be granted access to this resource. It is reserved, and neither the localhost nor 127.x.y.z can be assigned to users on the Internet.

主站蜘蛛池模板: 遂溪县| 白银市| 咸阳市| 龙南县| 大英县| 榆树市| 利津县| 安泽县| 宣城市| 乌拉特中旗| 会东县| 阜康市| 兴安盟| 高阳县| 和顺县| 佛学| 泾源县| 堆龙德庆县| 比如县| 来宾市| 凤台县| 芜湖市| 石渠县| 禹州市| 长治市| 三门峡市| 鸡西市| 隆昌县| 通化县| 平远县| 尖扎县| 南部县| 民和| 霍邱县| 新余市| 独山县| 乐东| 绥德县| 石河子市| 晋中市| 新巴尔虎左旗|