在使用finalshell远程连接虚拟机时,通过ifconfig指令无法查看到ens33的ip地址
检查虚拟机网络模式配置
将虚拟机网络模式改为仅主机模式
通过设备管理器,确保虚拟机的网络模式为已启用
通过任务管理器,确保虚拟机的VMnetDHCP,VMware NET Service服务为已启动
进入root模式
终端输入 ifup ens33出现下列错误
[oldsix@localhost ~]$ su
Password:
[root@localhost oldsix]# ifup ens33
Error: Connection activation failed: No suitable device found for this connection (device ens33 not available because device has no carrier).
依次输入下列指令
[root@localhost oldsix]# chkconfig NetworkManager off
Note: Forwarding request to 'systemctl disable NetworkManager.service'.
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@localhost oldsix]# chkconfig network on
[root@localhost oldsix]# service NetworkManager stop
Redirecting to /bin/systemctl stop NetworkManager.service
[root@localhost oldsix]# service network start
Starting network (via systemctl): [ OK ]
再次重启ens33网卡失败
[root@localhost oldsix]# ifconfig
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 760 bytes 65976 (64.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 760 bytes 65976 (64.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a7:63:8c 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
[root@localhost oldsix]# ifup ens33
Determining IP information for ens33... failed; no link present. Check cable?
通过以下指令,编辑ifcfg-ens33文件,在文件最后添加以下代码保存并退出
check_link_down() {
return 1;
}
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=4a223820-9ba5-4cc0-a506-02ae40a2763f
DEVICE=ens33
ONBOOT=no
check_link_down() {
return 1;
}
再次重启ens33成功
[root@localhost oldsix]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-ens33
[root@localhost network-scripts]# ifup ens33
Determining IP information for ens33... done.
此时通过ifconfig指令能成功看到虚拟机ip地址
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.149.128 netmask 255.255.255.0 broadcast 192.168.149.255
inet6 fe80::20c:29ff:fe8c:870 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:8c:08:70 txqueuelen 1000 (Ethernet)
RX packets 52 bytes 6072 (5.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 31 bytes 5243 (5.1 KiB)
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 760 bytes 65976 (64.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 760 bytes 65976 (64.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a7:63:8c 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
整个过程
[oldsix@localhost ~]$ ifup ens33
Users cannot control this device.
[oldsix@localhost ~]$ su
Password:
[root@localhost oldsix]# ifup ens33
Error: Connection activation failed: No suitable device found for this connection (device ens33 not available because device has no carrier).
[root@localhost oldsix]# ifconfig
ens33: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:0c:29:8c:08:70 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 696 bytes 60408 (58.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 696 bytes 60408 (58.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a7:63:8c 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
[root@localhost oldsix]# chkconfig NetworkManager off
Note: Forwarding request to 'systemctl disable NetworkManager.service'.
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Removed symlink /etc/systemd/system/network-online.target.wants/NetworkManager-wait-online.service.
[root@localhost oldsix]# chkconfig network on
[root@localhost oldsix]# service NetworkManager stop
Redirecting to /bin/systemctl stop NetworkManager.service
[root@localhost oldsix]# service network start
Starting network (via systemctl): [ OK ]
[root@localhost oldsix]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# vi ifcfg-ens33
[root@localhost network-scripts]# ifup ens33
Determining IP information for ens33... done.
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.149.128 netmask 255.255.255.0 broadcast 192.168.149.255
inet6 fe80::20c:29ff:fe8c:870 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:8c:08:70 txqueuelen 1000 (Ethernet)
RX packets 52 bytes 6072 (5.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 31 bytes 5243 (5.1 KiB)
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 760 bytes 65976 (64.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 760 bytes 65976 (64.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:a7:63:8c 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