Install vitualBox on win7 and then install ubuntu12.04, install samba server problem

  
        

1 Install samba:
sudo apt-get install sambasudo apt-get install sambafs Let's share the group read and write folders, assuming you want to share the folder: /home/andy/sharemkdir /home /andy/sharechmod 777 /home/andy/share

Backing up and editing smb.conf allows network users to access
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backupsudo gedit /etc/samba /smb.conf adds the following lines to the end of the file [Share] #This means that there will be a shared directory called share in the smb shared file directory and directory. Common Folder with username and passwordpath = /home/andy /sharepublic = yes #Note that if yes, then you don't need to enter the username and password when accessing other computers. If you want someone else to enter, please remove this line of code writable = yes # means that this directory is set for this user. Read and write available = yesbrowseable = yes Add new user sudo useradd smb # Note that the user of samba server must be ubuntu user, so must first Add users in ubuntu and then add users to the samba server and set the password: sudo smbpasswd -a amb #Note If you do not add this user to ubuntu, here will add failure

2 problem
Complete the samba server according to the above Installation, it is reasonable to directly sudo /etc/init.d/samba(smbd) restart to restart the service, you can use it, but I have encountered a problem. That is, I see that there are two network cards on the Internet, but I only have one, and I can view the ip of ubuntu in my virtual machine through ifconfig is 10.0.2.15. The ip of our router here is 10.0.0.1, so these two are not in one subnet, so we can't access samba through the network. How to solve it? Here you must modify the network settings in the virtual machine, set the nat as a bridge NIC, the following describes the difference between the two modes: whether the virtual machine bridge or NAT is occupying the real machine network. There are only a few differences between the two methods. In networks that use IP or dial-up connection speed limit, the difference is obvious, just like the environment of the above post. For an inappropriate but simple example, a 100 Mbps NIC can be thought of as a 100-lane highway. At present, most of the networks used by people in China are not so high, so the network card processing margin is very large, that is, there are many idle lanes. The network in that post does not limit the number of access computers, but limits the bandwidth of each access 4M. It is equal to each person on the road, giving you four lanes, but does not limit you to several. If you use a virtual machine bridge, it is equivalent to a few false reports in a name. The virtual machine bridge network can be treated as if you are using a switch. Each virtual machine and your real machine are connected to a switch, all in a flat network. In this case, without limiting the number of access computers, but each computer limits the bandwidth of 4M, each bridged networked virtual machine applies for a separate 4M bandwidth, even if you open three virtual machines at the same time, then the total number of virtual machines As for the total bandwidth of 12M, you have 4M in real time, and each system download can independently use the 4 lanes that you applied for. On the surface, it is not to seize the real machine network, because the total processing capacity of the real network card is 100 lanes, and now only a fraction of it is used, and there are still more spare channels. Actually, you can see the actual network card occupancy rate. It is definitely the sum of all virtual machine and real machine network bandwidth. The same is still the community, if you are not speed, your 100-megabit network card can run full hundred megabytes, Gigabit network card can run full Gigabit. According to the above explanation, do you think that the bridged virtual machine will not grab the real network when it is downloading at full speed? A virtual machine that uses the NAT method to access the Internet, the network is transited through the host, and the virtual machines are hung under the real machine name. Equal to the real machine is a router, apply for an online quota, with 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. Solved the above problem, you will find that the ubuntu ip in the virtual machine has become 10.0.9.X so that we are in a subnet, so we can go to the samba server.

3 Note
After installing the samba server first, if you want to set it up easily, it is actually very simple. According to this URL setting, you can go directly to the image interface: http://www.cnblogs.com/king -77024128/articles/2666298.html. But I still want to play the game by myself. . . . . In addition, let's talk about several modes of virtual machine network:

virtual machine network mode

Whether it is vmware, virtual box, virtual pc and other virtual machine software, in general, virtual machine has three network modes: Br>

1.Bridge

2.NAT

3.Host-Only

Which network is suitable for your own virtual machine?

Bridging

A bridged network means that the local physical NIC and the virtual NIC are bridged by the VMnet0 virtual switch. The physical NIC and the virtual NIC are in the same position on the topology map, then the physical NIC and the virtual NIC are Equivalent to being on the same network segment, the virtual switch is equivalent to a switch in a real network, so the IP addresses of the two network cards must also be set to the same network segment.

So when we want to use virtual machines on the LAN and provide services to other PCs on the LAN, such as providing ftp, providing ssh, and providing http services, we must choose the bridge mode.

For example, there is a router in the university dormitory. Four people in the dormitory connect to this router. The wanip of the router is ignored. This ip is dynamically obtained, and the default is 192.168.1.1 (gateway). The mask is 255.255.255.0. The other four people automatically get ip, assuming that the ip of four people is:

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

Then 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 (network address all 0 and all Except for 1, then remove the ip address of the four people of ABCD)

Then the virtual machine's ip address can be set to 192.168.1.98/255.255.255.0, set this ip address, ABCD these four people can pass 192.168 .1.98 access to the virtual machine, if the virtual machine needs to go to the external network, then you need to configure the routing address of the virtual machine, which is 192.168.1.1, so that the virtual machine can go to the external network, but, we generally use the domain name through the Internet. To access the external network, so we also need to configure a dns server for the virtual machine, we can simply configure the dns server address as google dns server: 8.8.8.8, at this point, the virtual machine can go online.

NAT

In NAT mode, the virtual machine uses the NAT (Network Address Translation) function to access the public network through the network where the host machine is located.

In the NAT mode, the network card of the virtual machine and the network of the physical network card are not on the same network. The network card of the virtual machine is a virtual network provided by vmware.

Comparison of NAT and Bridging:

(1) Both NAT mode and bridge mode virtual machines can be connected to the external network.

(2) Because the network of NAT is in a virtual network provided by vmware, other hosts on the LAN cannot access the virtual machine, and the host can access the virtual machine, and the virtual machine can access all hosts of the local area network. Because the real LAN is relative to the virtual network of NAT, it is the external network of the virtual network of NAT. Those who do not understand can check the relevant knowledge of NAT.

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

If you build a virtual machine, just for yourself, you don't need to use it for other people on the LAN, you can choose NAT. After all, the TCP/IP configuration information of the virtual system in NAT mode is VMnet8 (NAT). The virtual network's DHCP server provides, as long as the virtual machine's network configuration is DHCP, then you do not need to perform any other configuration, only the host machine can access the Internet, you can make the virtual machine network.

For example, if you want to build multiple virtual machine clusters, use them as tests, and the host machine may be a notebook, ip is not fixed. This kind of application scenario, we need to adopt the nat mode, but we have to consider a problem, the virtual machine needs to visit each other, the default is dhcp, the ip of the virtual machine is restarted every time, ip is not fixed, so we You need to manually set the ip address of the virtual machine.

But we still don't know the information about the virtual network where the virtual machine NIC is located, such as the routing address of the virtual machine network, the subnet mask, so we need to check the information of the nat virtual network first.

Using vmware, after configuring the virtual network information in Edit->Virtual Network Editor, see the following figure, pay attention to VMnet8, VMnet8 is equivalent to a route of the machine, and the virtual machine passes NAT after setting it. If the route is online, you can view its network address, routing address, and subnet mask.

Select VMnet8->NAT settings, you can see that the subnet ip is displayed as 192.168.233.0, the subnet mask is 255.255.255.0, then the routing address is actually the gateway IP, they are the same Something, here is 192.168.233.2.

The next step is to do it. Set the ip, subnet mask, and routing address on the corresponding virtual machine to the external network. As for dns, set it to 8.8.8.8.

Host-Only

In Host-Only mode, the virtual network is a fully enclosed network, and the only one that can access it is the host. In fact, the Host-Only network is very 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 the host and the virtual machine is accomplished through the VMware Network Adepter VMnet1 virtual NIC.

The purpose of Host-Only is to establish an internal network that is isolated from the outside world to improve the security of the internal network. This feature may not make much sense to the average user, but large service providers often take advantage of this feature. If you want to provide routing functions for the VMnet1 network segment, you need to use RRAS instead of XP or 2000 ICS, because ICS will change the IP address of the intranet to 192.168.0.1, but the virtual machine will not give VMnet1 virtual If the network card allocates this address, then the host and the virtual machine cannot communicate with each other.

Overview

In VMware's 3 network mode, the NAT mode is the easiest, and basically does not require manual configuration of IP addresses and other related parameters. As for the bridge mode, an extra IP address is needed. If it is in the internal network environment, it is still very easy. If it is ADSL broadband, it is more troublesome. The ISP generally does not provide a public IP address.

Copyright © Windows knowledge All Rights Reserved