Share files with linux virtual machines in windows (below)
Source: Internet
Author: User
Share files with linux virtual machines in windows (below)-Linux general technology-Linux technology and application information. The following is a detailed description. Two other common methods
Two solutions are most commonly used:
1. FTP access
2. Samba Service
For both FTP and Samba, you must first analyze the Host-Guest network connection in the virtual machine environment. Basically, the Host and Guest machines can be interconnected as two machines in the LAN. Now we need to reconsider the network connection methods mentioned in "Virtual Machine network configuration.
At that time, we chose to use the NAT mode for network connection. This is a way to use the DHCP service for network connection. That is to say, the Guest machine does not have its own fixed IP address, this address is obtained from the Host machine after the system is started, and is temporarily provided to the Guest machine. In this network connection mode, set the IP address acquisition method of the system in the Guest machine to automatic retrieval. No matter how the Host machine is connected to the Internet, as long as the Host can access the Internet, the Guest machine can also access the internet.
Although this method is used, it is very convenient to connect to the Internet, but the LAN connection between Host-Guest is really a headache, the IP address of VMnet8 is not in the same CIDR block as the IP address of the Host. After one night, no good solution was found. Finally, the NAT mode was discarded. Change the network connection mode of the Linux virtual machine to Bridge.
Bridge mode bridges the virtual network card of a VM to the physical network card of a Host. It can be understood that the Guest Host and the Host are in the same status, and the network relationship is equal, this is the most understandable LAN interconnection method for people like me who are more idiotic about routing.
My network service is a Community LAN network, and the IP address is automatically obtained. I don't have to worry about changing it. I also set the network of the Guest machine to automatically get the IP Address:
Application --> system settings --> network --> edit eth0 Device
The Host and Guest are in the same network segment, basically like the two machines in the LAN. Set FTP for the Host. FTP is used to access the Host resources, and file management is not convenient.
Another way to share Windows resources is Samba, which is favored by many Linux users. Samba is a set of software that enables UNIX systems to apply the Microshoft network communication protocol. It enables computers running UNIX systems to share drives and printers with computers running Windows systems. It is ideal for Windows and Linux networks. The Samba Server is attached to Red Hat AS 4.0, but it does not run automatically at system startup by default. You can use the service command to view and control the Samba service:
View the Samba service running status: # service smb status
Start the Samba service: # service smb start
Stop Samba service: # service smb stop
You can also set to automatically start the Samba service when the system restarts: # chkconfig -- level 345 smb on
First, set the folder or drive Web Sharing in Windows and set its alias, such as:/study
Then, log on to the smb service as a user in Linux:
Common error messages:
1. Firewall Problems
When using the Samba service, both Host and Guest should disable the firewall. How to disable firewall in Linux: System Settings> Server Settings> services> iptable
2. the logon username or password is incorrect.
Verify the user name and password.
Successfully logged on to smb
Use the LS command to view shared files in the current directory
You can use the get command to download an object from the server:
Smb: \> get file1 file2 (download file1 from the server and save it locally in the name of file2-the default root directory)
Exit command to Exit the smb server
If you still find file management inconvenient, you can use the smbmount command to mount Windows Shared Folders or drives:
# Smbmount // 192.168.0.162/study/mnt/mystudy? O username = admin
Among them, 192.168.0.162 is the Host IP address, study is the alias of the shared folder,/mnt/mystudy is the mount point, which can be created by # mkdir/mnt/mystudy, and admin is the Host login username.
Open the Mount directory.
Does this seem to get used to much more? The file management interface in Windows is almost the same.
At this point, the virtual machine Linux shared host Windows resources are basically implemented, and it is very simple to complete, but it has encountered many problems.
I have not studied linux in depth, so I chose a simple shared folder to share files. For the FTP and SAMBA modes, We will summarize them here and learn more about the network later! Haha!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service