问题
ubuntu服务器配置经常遇到临时需要网络下载文件需求, 通过有线连接又来不及
解决方法
使用手机usb为ubuntu服务器提供网络
- 先在ubuntu上运行
ifconfig
查看当前的网络接口, 一会看看多了哪个网口

1. 手机端操作
-
先使用usb数据线将手机连接到服务器上
-
打开手机的usb共享网络

2. ubuntu上操作
进入ubuntu服务器的终端命令行, 查看是否将USB接口识别为网络接口
- 输入ifconfig
- 我发现我的服务器多了
enx3ebc2d4385f3
, 但是我在其他机器上一般为usb0

为网络接口分配ip地址, 如果你是usb0, 就输入dhclient usb0
bash
dhclient enx3ebc2d4385f3
3. 检查能否上网
查看网络接口 ifconfig
, 查看是否分配ip

或直接 ping QQ 能否ping通
bash
ping www.qq.com
