1、安装完ubuntu server 18.04 后,笔记本电脑的有线网卡已经识别了,但是没有ip, 并且插上网线后端口灯不亮。
解决方法:
第一步、配置端口链路状态为 up
# ip link set dev xxx up
第二步、配置网口的静态Ip地址。
ubuntu server 使用netplan 工具进行配置,参考官网配置如下:
https://ubuntu.com/server/docs/network-configuration
To configure your system to use static address assignment, create a netplan configuration in the file /etc/netplan/99_config.yaml
. The example below assumes you are configuring your first Ethernet interface identified as eth0. Change the addresses, gateway4, and nameservers values to meet the requirements of your network.
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 10.10.10.2/24
gateway4: 10.10.10.1
nameservers:
search: [mydomain, otherdomain]
addresses: [10.10.10.1, 1.1.1.1]
The configuration can then be applied using the netplan command.
sudo netplan apply
第三步:配置网口的dns server
# vi /etc/resolv.conf
nameserver: 内容填写为其他电脑上可以分配的dns server ip.
例如: 101.198.198.198 221.130.33.52