aarch 64 Debian raspberry pi 系统 bootwlan0 配置文件调用解析

aarch 64 Debian raspberry pi 系统 /boot/wlan0 配置文件调用解析

/boot/wlan0软连接指向/etc/network/interface.d/wlan0

/etc/network/interface文件中非注释段为:

source-directory /etc/network/interfaces.d

在ubuntu manual上关于/etc/network/interface文件的描述:

http://manpages.ubuntu.com/manpages/trusty/en/man5/interfaces.5.html

其中关于source-directory的描述:

Similarly,  "source-directory"  keyword  is used to source multiple files at once, without
specifying them individually or using shell globs. Additionally,  when  "source-directory"
is  used,  names  of  the  files  are  checked  to match the following regular expression:
^[a-zA-Z0-9_-]+$. In other words, the names must consist  entirely  of  ASCII  upper-  and
lower-case  letters,  ASCII  digits,  ASCII  underscores,  and ASCII minus-hyphens. In the
directory path, shell wildcards may be used as well.

When sourcing files or  directories,  if  a  path  doesn't  have  a  leading  slash,  it's
considered  relative  to the directory containing the file in which the keyword is placed.
In the example above, if the file is located  at  /etc/network/interfaces,  paths  to  the
included files are understood to be under /etc/network.

By default, on a freshly installed Debian system, the interfaces file includes a line to
source /etc/network/interfaces.d directory.

即source-directory用于一次获取多个配置文件

调用systemctl查看network.service和network-manager.service的状态:

  • network.service状态:
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2020-09-01 01:17:37 CST; 2 weeks 3 days ago
     Docs: man:interfaces(5)
  Process: 286 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS)
 Main PID: 286 (code=exited, status=0/SUCCESS)
    Tasks: 2 (limit: 1073)
   Memory: 17.5M
   CGroup: /system.slice/networking.service
           ├─408 /sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf -C /run/wpa_supplicant
           └─439 /sbin/dhclient -4 -v -i -pf /run/dhclient.wlan0.pid -lf /var/lib/dhcp/dhclient.wlan0.leases -I -df /var/lib/dhcp/dhclient6.wlan0.leases wlan0

Sep 18 15:58:58 havana dhclient[439]: DHCPOFFER of 192.168.1.116 from 192.168.1.1
Sep 18 15:58:58 havana dhclient[439]: DHCPREQUEST for 192.168.1.116 on wlan0 to 255.255.255.255 port 67
Sep 18 15:58:58 havana dhclient[439]: DHCPACK of 192.168.1.116 from 192.168.1.1
Sep 18 15:58:59 havana dhclient[439]: bound to 192.168.1.116 -- renewal in 3591 seconds.
Sep 18 16:58:49 havana dhclient[439]: DHCPREQUEST for 192.168.1.116 on wlan0 to 192.168.1.1 port 67
Sep 18 16:58:49 havana dhclient[439]: DHCPACK of 192.168.1.116 from 192.168.1.1
Sep 18 16:58:49 havana dhclient[439]: bound to 192.168.1.116 -- renewal in 2934 seconds.
Sep 18 17:47:43 havana dhclient[439]: DHCPREQUEST for 192.168.1.116 on wlan0 to 192.168.1.1 port 67
Sep 18 17:47:43 havana dhclient[439]: DHCPACK of 192.168.1.116 from 192.168.1.1
Sep 18 17:47:43 havana dhclient[439]: bound to 192.168.1.116 -- renewal in 3032 seconds.
~
  • network-manager.service状态:
● NetworkManager.service - Network Manager
   Loaded: loaded (/lib/systemd/system/NetworkManager.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:NetworkManager(8)

可知network-manager服务未开启

网络连接由network服务建立

/lib/systemd/目录下多为.target和.wants文件,主要用于系统服务启动流程

查看当前系统运行级别:

$runlevel

返回值5

回到/etc/rc5.d

查看启动目录

其中S01dhcpcd调用interface配置文件:

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:          dhcpcd
# Required-Start:    $remote_fs $local_fs
# Required-Stop:     $remote_fs $local_fs
# Should-Start: 
# Should-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: IPv4 DHCP client with IPv4LL support
# Description:
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DHCPCD=/sbin/dhcpcd
NAME=dhcpcd
PIDFILE=/var/run/dhcpcd.pid

test -x $DHCPCD || exit 0

INTERFACES=/etc/network/interfaces

. /lib/lsb/init-functions

INTERFACES=/etc/network/interfaces

interface文件调用

source-directory /etc/network/interfaces.d

interface.d文件夹中配置了两个文件:

lo:本地环回

wlan0:无线网络配置(热插拔/ssid/ssid-passwd)

至此aarch 64 Debian raspberry pi 系统 /boot/wlan0 配置文件调用解析完成

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值