ubuntu18.04server 真机无法自动获取IP解决方法


1、查看正确的网卡名称

1 sudo ifconfig -a

因为此图为虚拟机搭建的,所以网卡名称为ens33,如果是真机的话则是enp0s**的名字

2、修改netwlpan文件

 1 sudo vim /etc/netplwan/50-cloud-init.yaml
 2 
 3 一下为默认配置文件
 4 
 5 # This file is generated from information provided by
 6 # the datasource.  Changes to it will not persist across an instance.
 7 # To disable cloud-init's network configuration capabilities, write a file
 8 # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
 9 # network: {config: disabled}
10 network:
11     ethernets:
12         ens33:
13             addresses: []
14             dhcp4: true
15             optional: true
16     version: 2

修改第12行的网卡名称和ifconfig -a中的第一个网卡的名称一样就可以了。

保存退出

1 :wq!   或  :x
2 reboot

重启系统,就可以解决了


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM