1.環境與相關軟件
1.1 本機系統win10家庭版,使用軟件Xshell,vmware15,虛擬機中的系統centos7
2.具體實現
2.1 由於在虛擬機中操作不太方便,使用終端遠程管理本地虛擬機中的服務器.這樣開着虛擬機就可在XShell中管理
2.2 使用ip a 或者 ifconfig等命令查看虛擬機的ip,
[linoxwong@CentOS-7-64 ~]$ ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.235.129 netmask 255.255.255.0 broadcast 192.168.235.255 inet6 fe80::7739:9602:d64b:bc45 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:9a:63:9b txqueuelen 1000 (Ethernet) RX packets 207271 bytes 307678779 (293.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 89761 bytes 5412462 (5.1 MiB) 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 48 bytes 4080 (3.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 48 bytes 4080 (3.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:ee:0a:c6 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
如上代碼,我使用了ifconfig命令后得到了三個網絡信息 ens33: lo: virbr0: 看你的系統用的網絡 我用的是ens33 所以在ens33中去找ip
2.3 本地橋接網卡的設置,使用shell連接網卡需要將VMware Virtual Ethernet Adapter for VMnet8(橋接) 與虛擬機的IP在一個網段中
2.4 得到了ip之后,我就能在xshell中連接了,如下 新建會話,主機寫上剛剛得到的ip
2.5 點了確定之后,輸入一次用戶,一次密碼之后就登錄上了,輸入用戶跟密碼忘記截圖了,下面是登錄進入的圖片
3. 總結
使用終端登錄之后,無需在虛擬機中操作,這樣只要掛着虛擬機就可以了。很方便。