Ubuntu 19.04
1 2 3 4 5 6 7 8 9
| ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel state DOWN group default qlen 1000 link/ether 00:0c:29:15:61:1c brd ff:ff:ff:ff:ff:ff
|
可以看到ens33网卡是DOWN的状态,使用ifup ens33命令说是未知网卡。
1 2
| ifup ens33 ifup: unknown interface ens33
|
在CentOS上使用的方法在Ubuntu上面不管用。
重启网络也是不行的。
1
| systemctl restart networking
|
最后使用如下命令:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| sudo dhclient ens33 ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 00:0c:29:15:61:1c brd ff:ff:ff:ff:ff:ff inet 192.168.229.129/24 brd 192.168.229.255 scope global dynamic ens33 valid_lft 1798sec preferred_lft 1798sec inet6 fe80::20c:29ff:fe15:611c/64 scope link valid_lft forever preferred_lft forever
|
ens33状态为UP了,ip也显示出来了。