本文参考Ubuntu的ip设置_含笑孙子-CSDN博客
1.参考配置DHCP网卡过程,要先ifconfig查看自己的网卡号
ifconfig
编辑文件/etc/network/interfaces:
sudo vi /etc/network/interfaces
并用下面的行来替换有关eth0的行:
# The primary network interface - use DHCP to find our address
auto ens33 #改成自己的网卡
iface ens33 inet dhcp
其中,ens33为我的的网卡号,按照自己的改就行了,restart:
sudo /etc/init.d/networking restart
2.为网卡配置静态IP参考Ubuntu的ip设置_含笑孙子-CSDN博客的就行了