- Raspberry Pi 2 Server Essentials
- Piotr J.Kula
- 498字
- 2021-07-16 11:10:05
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:

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), or192.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.
- Photoshop智能手機APP UI設計之道
- Java面向對象軟件開發
- HTML5+CSS3基礎開發教程(第2版)
- Apache Spark Graph Processing
- 深入理解Java7:核心技術與最佳實踐
- jQuery從入門到精通 (軟件開發視頻大講堂)
- 單片機應用技術
- 深度強化學習算法與實踐:基于PyTorch的實現
- Yocto for Raspberry Pi
- HTML5從入門到精通(第4版)
- Machine Learning in Java
- HTML+CSS+JavaScript網頁設計從入門到精通 (清華社"視頻大講堂"大系·網絡開發視頻大講堂)
- Spring技術內幕:深入解析Spring架構與設計原理(第2版)
- Python自然語言理解:自然語言理解系統開發與應用實戰
- PhoneGap 4 Mobile Application Development Cookbook