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

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.

主站蜘蛛池模板: 太湖县| 武威市| 玉山县| 盱眙县| 呼玛县| 阿克陶县| 连南| 阿鲁科尔沁旗| 湘潭市| 固阳县| 雅江县| 环江| 丽水市| 澳门| 册亨县| 兴化市| 忻城县| 中江县| 台安县| 新余市| 虞城县| 寿光市| 神木县| 岳阳县| 安泽县| 遂溪县| 鄄城县| 宜阳县| 白城市| 秦安县| 扎鲁特旗| 来凤县| 澳门| 广州市| 镇坪县| 乌拉特前旗| 十堰市| 太白县| 昆山市| 鄂尔多斯市| 滕州市|