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

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.

主站蜘蛛池模板: 靖宇县| 龙井市| 德江县| 出国| 望谟县| 武清区| 高安市| 安吉县| 白银市| 连平县| 青铜峡市| 龙门县| 南开区| 沅陵县| 秦皇岛市| 玉屏| 牡丹江市| 柳江县| 揭西县| 丰顺县| 兴海县| 女性| 饶平县| 东至县| 文登市| 资阳市| 理塘县| 莆田市| 旬阳县| 县级市| 涟水县| 吐鲁番市| 内江市| 瓦房店市| 四川省| 寿光市| 玉屏| 正阳县| 洪洞县| 宁安市| 常熟市|