Install ubuntu12.04 in vitualBox on win7 and install the samba server.

Source: Internet
Author: User

1. install samba: sudo apt-get install samba
Sudo apt-get install sambafs

Next we will share the readable and writable folders of the group. Assume that the folder you want to share is/home/andy/share.
Mkdir/home/andy/share
Chmod 777/home/andy/share

Back up and edit smb. conf to allow network users to access

Sudo cp/etc/samba/smb. conf/etc/samba/smb. conf_backup
Sudo gedit/etc/samba/smb. conf
Add the following lines to the end of the file
[Share] # Here It indicates that there is a share directory under the smb shared file directory and directory.
Comment = Shared Folder with username and password
Path =/home/andy/share
Public = yes # Note: If yes is used, the user name and password are not required for access from other computers. If you want other users to enter the password, remove this line of code.
Writable = yes # indicates that this directory can be read and written to this user.
Available = yes
Browseable = yes

Add the new user sudo useradd smb below # note that the user of the samba server must be a user of ubuntu, so you must first add the user to ubuntu and then add the user to the samba server and set the password: sudo smbpasswd-a amb # Note that if you do not add this user in ubuntu, the addition will fail.
2. the samba server is installed according to the above steps, and sudo/etc/init directly. d/samba (smbd) restart restarts the service and you can use it. However, I encountered a problem. I think there are two NICs on the Internet, but I only have one, and I can check that the ubuntu ip address in my virtual machine is 10.0.2.15 through ifconfig and can access the Internet. The ip address of the router here is 10.0.9.1, so these two are not in one subnet, so samba cannot be accessed through the network.
How can this problem be solved? Here, you must modify the network settings in the Virtual Machine and set nat as a bridge Nic. The following describes the differences between the two modes:
Both Virtual Machine bridging and NAT occupy the network of the real machine. There are only some differences between the two methods. The difference is obvious in the network that uses IP addresses or dial-up connections to limit the speed, just like the environment in the post above.
For example, a 100 gigabit network card can be considered as a-lane road. At present, most people in China use less network, so there is a lot of surplus in Nic processing, that is, there are many idle lanes. The Network in that post does not limit the number of computers connected, but limits the bandwidth of 4 mbps for each access. It is equivalent to assigning four lanes to each person on the road, but you are not limited to reporting a few. If you use virtual machine bridging, it is equivalent to falsely reporting several virtual machines under one name. The Virtual Machine bridging network can be regarded as the switch you are using. Each Virtual Machine and your real machine are connected to a vswitch and are in a level network. In this case, the number of connected computers is not limited, but the bandwidth of each computer is limited to 4 Mbps, each virtual machine that bridges the network applies for an independent 4 mbps bandwidth, even if you activate three virtual machines at the same time, the total bandwidth of the virtual machine is 12 Mb, and the total bandwidth of your real machine is 4 MB, each system download can use the four lanes that you have applied for independently. On the surface, the network is not preemptible because the total volume of network cards on the real machine is 100 lanes. It is only a few minutes now, and there are more free channels. Actually, you can see the network card usage of the real machine. It must be the total bandwidth of all virtual machines attached to the real machine.
In the same community, if the speed is not limited, your Mbps NIC will be able to run over Mbps, And the Gigabit NIC will be able to run over Gbps. According to the above explanation, do you want to skip the network of the real machine when the bridge Virtual Machine downloads at full speed?
For virtual machines that use NAT to access the Internet, the network is transitioned through the host, and all the virtual machines are hung under the host name. A virtual machine is a vro. It applies for an Internet quota and uses a virtual machine hidden under it to access the Internet. Naturally, the total network used by all virtual machines is limited to one network channel of the real machine.

After the above problem is solved, we will find that the ubuntu ip address in the virtual machine is changed to 10.0.9.X, so that we are in a subnet, so we can go to the samba server. 3. After installing the samba server, if you want to set it easily, you can simply go to the image page at http://www.cnblogs.com/king-77024128/articles/2666298.html. But I still want to give it a try ..... In addition, let's talk about several virtual machine network modes: Virtual Machine Network Mode

Virtual Machine software, such as vmware, virtual box, and virtual pc, generally has three network modes:

1. Bridging

2. NAT

3. Host-Only

Which network is suitable for your own virtual machine?

Bridging

A bridge network is a bridge between a local physical network card and a virtual network card through a VMnet0 virtual switch. The physical network card and the virtual network card are in the same position on the topology, the physical and virtual NICs are equivalent to the same network segment, and the virtual switch is equivalent to a switch in a real network. Therefore, the IP addresses of the two NICs must be set to the same network segment.

Therefore, when we want to use virtual machines in the LAN to provide services to other PCs in the LAN, such as ftp, ssh, and http services, we need to select the bridge mode.

For example, if there is a vro in the dormitory and four people in the dormitory connect to the vro, The wanip address of the vro will be ignored. The ip address is dynamically obtained, and the lanip address is 192.168.1.1 (GATEWAY) by default ), the subnet mask is 255.255.255.0. The other four automatically obtain ip addresses. Assume that the ip addresses of the other four are:

A: 192.168.1.100/255.255.255.0, B: 192.168.1.101/255.255.255.0, C: 192.168.1.102/255.255.255.0, D: 192.168.1.103/255.255.255.0

The ip address of the virtual machine can be set to 192.168.1.2-192.168.1.99, 192.168.1.104-192.168.1.254 (except for all the network addresses 0 and 1, and the ip addresses of the four members of the ABCD)

The Virtual Machine IP address can be set to 192.168.1.98/255.255.255.0. With this IP address set, the four members of ABCD can access the virtual machine through 192.168.1.98. If the virtual machine needs to go to the Internet, you also need to configure the route address of the virtual machine, namely 192.168.1.1, so that the virtual machine can be connected to the Internet. However, we generally access the Internet through the domain name, therefore, we also need to configure a dns server for the virtual machine. We can simply configure the dns server address as google's dns server: 8.8.8.8.8. Now, the virtual machine can access the Internet.

NAT

In NAT mode, a virtual machine accesses the public network through the network of the host machine through the NAT (Network Address Translation) function.

In NAT mode, the network of the virtual machine's Nic and physical NIC are not in the same network. The NIC of the virtual machine is a virtual network provided by vmware.

Comparison between NAT and bridge:

(1) Both the NAT mode and the bridge mode can be connected to the Internet.

(2) because the NAT network is in a virtual network provided by vmware, other hosts in the LAN cannot access the virtual machine, while the host can access the virtual machine, virtual machines can access all hosts in the LAN, because the real LAN is the Internet of the NAT Virtual Network relative to the NAT virtual network. People who do not know the NAT can check the NAT knowledge.

(3) In the bridge mode, multiple virtual machines can access each other. In the NAT mode, multiple virtual machines can also access each other.

If you create a virtual machine for your own purposes and do not need to use it for others on the LAN, you can select NAT, after all, the TCP/IP configuration information of the Virtual System in NAT mode is provided by the DHCP server of the VMnet8 (NAT) virtual network, as long as the network configuration of the virtual machine is DHCP, you do not need to configure any other configurations. You only need to allow the host machine to access the Internet to connect the virtual machine to the Internet.

For example, if you want to build multiple virtual machine clusters for testing, and the host machine may be a notebook, the ip address is not fixed. In this application scenario, we need to adopt the nat mode, but we need to consider a problem where mutual access is required between virtual machines. dhcp is used by default, and the ip address of the virtual machine is restarted each time, ip addresses are not fixed, so we need to manually set the ip address of the virtual machine.

However, we do not know any information about the virtual network where the Virtual Machine network card is located, such as the Virtual Machine network routing address and subnet mask. Therefore, we need to first check the nat virtual network information.

Using vmware, After configuring the Virtual Network information in Edit-> Virtual Network Editor, you can see that, pay attention to VMnet8, which is equivalent to a local route, after the Virtual Machine Sets NAT, it will use this route to access the Internet. You can view its network address, route address, and subnet mask.

Select VMnet8-> NAT settings. The subnet ip address is 192.168.233.0 and the subnet mask is 255.255.255.0. The routing address is actually the gateway IP address. It is the same thing. Here it is 192.168.233.2.

Next, you can set the ip address, subnet mask, and route address on the corresponding virtual machine to go to the Internet. As for dns, you can set it to 8.8.8.8.8.

Host-Only

In Host-Only mode, the virtual network is a fully closed network, and the Only access to the virtual network is the Host. In fact, the Host-Only network is similar to the NAT network. The difference is that the Host-Only network does not have a NAT service, so the virtual network cannot connect to the Internet. Communication between hosts and virtual machines is achieved through the VMware Network Adepter VMnet1 virtual Network card.

The purpose of Host-Only is to establish an internal network isolated from the outside to improve the security of the Intranet. This feature may be of little significance to common users, but it is often used by large service providers. If you want to provide the routing function for the VMnet1 CIDR block, you need to use RRAS instead of XP or 2000 ICS, because ICS will change the Intranet IP address to 192.168.0.1, but the virtual machine does not allocate this address to the VMnet1 virtual Nic, so the host and virtual machine cannot communicate.

Summary

In VMware 3, the NAT mode is the simplest, and you do not need to manually configure IP addresses and other related parameters. As for the bridge mode, additional IP addresses are required. If it is easy to use in the Intranet environment, it is more difficult to use ADSL bandwidth, generally, the ISP does not provide a public IP.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.