电脑安装使用ubuntu18.04 service后,能够使用两种方式连接网络,一种是有线连接,另外一种是无线连接
-
有线连接
可以直接插上网线连接,当然,如果是公司网络还需要设置代理什么的,可以通过一台电脑主机使用squid工具设置正向代理,然后直接和ubuntu servcie通过网线直连,使service通过可访问外网的机器连接网络 -
无线连接
需要配置netplan工具进行连接,过程如下:
- 安装wireless-tools以及network-manager无线网络工具
sudo apt install wireless-tools
sudo apt-get install network-manager
- 查看无线网络ip
sudo iwconfig
出现如下字样
wlp8s0 IEEE 802.11 ESSID:"zy-waiwang"
Mode:Managed Frequency:2.412 GHz Access Point: 38:91:D5:A4:1A:91
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
- 检查扫描
sudo iwlist wlp8s0 scanning
编辑配置文件如下
vim /etc/netplan/50-cloud-init.yaml
# This file is generated from information provided by
# the datasource. Changes to it will not persist across an instance.
# To disable cloud-init's network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
renderer: NetworkManager
ethernets: # 配置有线网络
enp4s0: # 有线网络的硬件名称
dhcp4: true
wifis: # 配置无线网络
wlp5s0: # 无线网络的硬件名称
dhcp4: true
access-points:
"wifi_name": # wifi的名称,需要替换成自己wifi名
password: "wifi_passwd" # wifi的密码,需要替换成自己wifi密码
version: 2