ubuntu ifconfig没有ip
$ ifconfig -a
ens33: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:**:**:**:**:** txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1876 bytes 114200 (114.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1876 bytes 114200 (114.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
问题
Looks to me like the interface is disabled:
$ ifconfig -a
ens33: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 00:**:**:**:**:** txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 1876 bytes 114200 (114.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1876 bytes 114200 (114.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
But ifup doesn't seem to know ens33 (or eth0):
$ ifup ens33
Unknown interface ens33
$ ifup eth0
Unknown interface eth0
解决方案
Add the following line to /etc/network/interfaces:
iface ens33 inet dhcp
Switch it on (enable it):
sudo ifup ens33
Good to go:
ping google.com

相关推荐
-
MySQL 由于 Java 日期 LocalDateTime 数据精度引发的线上问题
MySQL 由于 Java 日期 LocalDateTime 数据精度引发的线上问题2025-04-02 00:59:31 -
MySQL最常用分组聚合函数2025-04-02 00:55:56
-
NGINX: 轮询调度、加权轮询调度、平滑加权轮询调度2025-04-02 00:55:49
-
在Windows平台上安装Nginx并设置开机自动启动服务2025-04-02 00:47:04
-
PHP判断文件或者目录是否可写,兼容windows/linux系统
PHP判断文件或者目录是否可写,兼容windows/linux系统2025-04-02 00:27:54