Connect to Virtual Machine and Network Setting
Lookup Host IP Address
Command: ipconfig getifaddr en0
Or
ifconfig
and find it after “en0:”
Mine is: 10.0.0.3
.
Problems
After installed the system image
OS: Mac
VM OS: CentOS7
Software: VMware Fusion
Virtual machine cannot connect to internet and host.
ping www.google.com
and ping 10.0.0.3
not working.
Procedure
- On the top, choose
Virtual Machine
>Network Adapter
>Network Adapter Settings...
- Choose
Bridged Networking
>Wi-Fi
- Go to VM’s terminal, enter
dhclient
, enter, then typeifconfig
, remember the ip address under “ens33”: “inet”. For example,10.0.0.195
. - In VM’s terminal, enter
vim /etc/sysconfig/network-scripts/ifcfg-ens33
, change the file to
1 | TYPE=Ethernet |
Note: Pay attention to BOOTPROTO=static
, ONBOOT=yes
, and the last 4 lines. The IPADDR
is what we got in step 3.
- In VM’s terminal,
systemctl restart network.service
Now, ping www.google.com
and ping 10.0.0.3
should work.
- In host’s terminal,
ping 10.0.0.195
should work as well. - May need to restart the VM to update the ip address shown in the VMWare.
SSH to VM on Mac
In host terminal, enter ssh user@ip-addr
(usually “user” is “root”). For me, it is ssh root@10.0.0.195
. Next, it will ask you to enter the root password. Then enter “yes” if it is the first time.
Enable Root Login
sudo vim /etc/ssh/sshd_config
- Uncomment
#PermitRootLogin no
and change it toPermitRootLogin yes
sudo systemctl restart sshd.service
- If doesn’t work, change root password using
sudo passwd root
File Transfer
Use SFTP
connection type.