增加 Systemd-Netowrkd 说明。
Signed-off-by: rick.chan <cy@haoan119.com>
This commit is contained in:
parent
fc2cf69f76
commit
43adc7a42f
|
@ -53,6 +53,8 @@ backend=headless-backend.so
|
|||
x11-backend.so
|
||||
```
|
||||
|
||||
output name 对应 /sys/class/drm 下的视频输出节点。
|
||||
|
||||
```bash
|
||||
sudo -E XDG_RUNTIME_DIR="/run/user/1000" weston-launch --tty=/dev/tty2 --user=cat
|
||||
|
||||
|
|
|
@ -10,3 +10,14 @@ NetworkManager 是一个标准的 Linux 网络配置工具套件,支持服务
|
|||
| nmtui | NetworkManager 的基于 curses 的简单文本用户界面(TUI) |
|
||||
| nm-connection-editor | NetworkManager 的基于 GUI 的图形用户界面配置工具 |
|
||||
| control-center | GNOME Shell 提供的图形用户界面工具,可供桌面用户使用。它整合了网络设置工具。 |
|
||||
|
||||
## 2. NetworkManager 服务
|
||||
|
||||
NetworkManager 服务主要是位于 /usr/lib/systemd/system 下的 NetworkManager.service,可以使用标准 systemctl 命令对该服务进行控制。
|
||||
|
||||
```bash
|
||||
sudo systemctl start NetworkManager
|
||||
sudo systemctl enable NetworkManager
|
||||
sudo systemctl stop NetworkManager
|
||||
sudo systemctl disable NetworkManager
|
||||
```
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
# Systemd-Netowrkd 说明
|
||||
|
||||
## 1. 服务控制
|
||||
|
||||
可以使用标准 systemctl 命令对该服务进行控制。
|
||||
|
||||
```bash
|
||||
sudo systemctl start systemd-networkd
|
||||
sudo systemctl enable systemd-networkd
|
||||
sudo systemctl stop systemd-networkd
|
||||
sudo systemctl disable systemd-networkd
|
||||
```
|
||||
|
||||
## 2. 配置
|
||||
|
||||
Systemd-Netowrkd 的配置文件在 /etc/systemd/network/ 目录下。
|
||||
|
||||
扩展名为 .network 是网络配置文件(IP 地址,网关等);扩展名为 .netdev 的是虚拟设备配置文件(如网桥)。
|
||||
|
||||
以下列举了一些常用配置模板:
|
||||
|
||||
### 2.1. Wired adapter using DHCP
|
||||
|
||||
可以使用通配符匹配多个网络接口。
|
||||
|
||||
/etc/systemd/network/20-wired.network
|
||||
|
||||
```bash
|
||||
[Match]
|
||||
Name=eth*
|
||||
|
||||
[Network]
|
||||
DHCP=yes
|
||||
```
|
||||
|
||||
### 2.2. Wired adapter using a static IP
|
||||
|
||||
/etc/systemd/network/20-wired.network
|
||||
|
||||
```bash
|
||||
[Match]
|
||||
Name=eth0
|
||||
|
||||
[Network]
|
||||
Address=10.1.10.9/24
|
||||
Gateway=10.1.10.1
|
||||
DNS=10.1.10.1
|
||||
```
|
||||
|
||||
### 2.3. Network bridge
|
||||
|
||||
需要先创建网桥虚拟设备:
|
||||
|
||||
/etc/systemd/network/25-br0.netdev
|
||||
|
||||
```bash
|
||||
[NetDev]
|
||||
Name=br0
|
||||
Kind=bridge
|
||||
```
|
||||
|
||||
对网桥网络进行配置:
|
||||
|
||||
/etc/systemd/network/25-br0.network
|
||||
|
||||
```bash
|
||||
[Match]
|
||||
Name=br0
|
||||
|
||||
[Network]
|
||||
DHCP=yes
|
||||
```
|
||||
|
||||
将网络接口添加进网桥:
|
||||
|
||||
/etc/systemd/network/25-br0-eth.network
|
||||
|
||||
```bash
|
||||
[Match]
|
||||
Name=eth*
|
||||
|
||||
[Network]
|
||||
Bridge=br0
|
||||
```
|
Loading…
Reference in New Issue