admin 管理员组

文章数量: 887021

OrangePi安装Armbian Ubuntu镜像,默认使用内置的armbian-config来设置网络,需要SSH登录才能设置。

如果需要采用Ubuntu下常见的netplan配置,则需要安装netplan,当前镜像版本是Ubuntu Focal (20.04)

# 安装netplan

sudo apt install netplan.io

# 新建配置文件

sudo touch /etc/netplan/50-cloud-init.yaml

开始写配置之前,要先了解一下当前设备的网卡名称!

# 查看IP信息

ip a

# 返回

1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

valid_lft forever preferred_lft forever

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000

link/ether 02:42:c4:6c:71:cb brd ff:ff:ff:ff:ff:ff

inet 192.168.0.35/24 brd 192.168.0.255 scope global eth0

valid_lft forever preferred_lft forever

inet6 fe80::bd4f:888e:21dc:b724/64 scope link noprefixroute

valid_lft forever preferred_lft forever

3: wlan0: mtu 1500 qdisc mq state UP group default qlen 1000

link/ether 12:42:c4:6c:71:cb brd ff:ff:ff:ff:ff:ff

inet 172.24.1.1/24 brd 172.24.1.255 scope global wlan0

valid_lft forever preferred_lft forever

inet6 fe80::1042:c4ff:fe6c:71cb/64 scope link

valid_lft forever preferred_lft forever

# lo是环回地址

# eth0是有线网卡地址

# wlan0是无线网卡地址

设置eth0为静态地址

network:

version: 2

ethernets:

eth0:

dhcp4: false

dhcp6: false

gateway4: 192.168.0.1

addresses: [192.168.0.35/24]

nameservers:

addresses: [223.5.5.5, 223.6.6.6]

保存配置后,需要应用配置才能生效

sudo netplan apply

本文标签: 网络 ssharmbian Armbian Netplan Ubuntu