First, directly modify the Ubuntu IP system configuration file
the network configuration file for Ubuntu IP is:/etc/network/interfaces can be set up after the DHCP or manually set the static passive IP. The front auto eth0, let the network card boot automatically mount, the following operation for the wired network in Ubuntu implementation of two network cards.
1. Configuring the NIC with DHCP (recommended)
(1) Open the file you want to edit interfaces its directory is/etc/network/interfaces
sudo vi/etc/network/interfaces
or: sudo gedit/etc/network/interfaces You can write the contents of a file in a text editor at this point, to make it more convenient
(2) Change the contents of the document to:
Auto ETH0
iface eth0 inet DHCP
(3) Use the following command to make the network settings effective
sudo/etc/init.d/networking Restart
(4) The above kind of direct modification of the configuration file, if you want to dynamically obtain the IP, you can also directly use the command:
sudo dhclient eth0
With this sentence, the IP address of the NIC Eth0 is set to 10.0.2.15 (the IP for the network card used to establish the bridge nap), at which time the virtual machine can ping the host, and can share the Internet with the host. (But at this point the host ping does not pass the virtual machine)
2. Configure a static Ubuntu IP address for the NIC
(1) Open the file you want to edit interfaces its directory is/etc/network/interfaces
sudo vi/etc/network/interfaces
or: sudo gedit/etc/networking/interfaces You can write the contents of a file in a text editor at this point, to make it more convenient
(2) Change the contents of the document to:
Auto ETH1
iface eth1 inet Static
Address 192.168.1.XXX
Netmask 255.255.255.0
Gateway 192.168.1.1
(3) Configure Dnssudo gedit/etc/resolv.conf//Use this statement to open the configuration DNS file, modify it
nameserver 202.119.230.8//For local Windows network DNS add, added by default (4) Use the following command to set the network sudo/etc/init.d/networking Restart or perform :
sudo ifup eth1
After this command is executed, the IP address of the virtual machine's Nic Eth1 is set to 192.168.1.XXX, and this IP address is in the same network segment as the host IP address, at which time the host can ping the virtual machine. (The premise is that Nat and bridging are already set up for this virtual machine)
Second, the realization of the host and the virtual machine communication between the preparatory knowledge: Host-only mode, the host is equivalent to a two-card computer, the physical network card is an external network, Vmnet1 is the intranet, at this time the virtual machine and host communication is the premise of Vmnet1 IP and virtual machine IP in the same network segment. Bridge mode, the host and virtual machine is equivalent to two computers on the same switch, at this time, the IP address of the virtual machine and the host's physical network card IP in the same network segment, this time can communicate, of course, including also including Ping. If not, it may be related to a firewall. The method used is to set up two virtual network cards, one of which is connected by NAT to connect the external network, and one is bridged to communicate with the host. Steps:
1. Before you start the virtual machine, The first virtual network card (that is, NAT) is set by default in "network" and then switched to Adapter2 enabling the second virtual network card and changing to Bridge connection mode (attached to select bridged Adapter,na Me select the local wired/wireless network card):
2, start the virtual machine, edit eth1, in the inside set the Ethernet interface eth1 IP address, subnet mask and gateway, this step is most important. Eth1 This network card is bridged, that is, with your host to communicate with each other, so the IP address set here to the host
same network segment (the IP address is automatically assigned when you set up a dynamically assigned IP address in interface or when you add a wireless card bridge in VirtualBox, and you do not need to customize), the gateway and subnet mask are consistent with the settings of the host, and then the IP is set to static. After you save the exit, after executing sudo ifup eth1, you can ping the host with each other.
3, use the sudo dhclient eth0 command to dynamically assign the address of the ETH0 network card, you can see the settings after this
IP is a proprietary IP address that is used for NAT connections and can be sisu after a NAT conversion.
4, with Ifconfig View network interface information, you can see three network cards, Eth0,eth1,lo.
Third, use the command set Ubuntu IP address
(1) Modify configuration file blacklist.conf disable Ipv6:sudo vi/etc/modprobe.d/blacklist.conf
(2) Add blacklist IPv6 at the end of the document and review the results: cat/etc/modprobe.d/blacklist.conf
(3) Set Ubuntu IP (set IP address and subnet mask for NIC eth0) sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0
(4) Ubuntu IP Settings Gateway sudo route add default GW 192.168.2.254
(5) Ubuntu IP Settings DNS modified/etc/resolv.conf, where nameserver DNS was added to address 1 and nameserver DNS address 2 was completed.
(6) Restart the Network service (if not, please restart Ubuntu:sudo reboot): sudo/etc/init.d/networking restart
(7) view current Ubuntu ip:ifconfig
Iv. using putty to log on to the remote server is Ubuntu in this article
Open the Putty.exe and set the relevant parameters:
A. Host Name: The IP address set in the remote Ubuntu server, which is the one set in the first three links of this article;
B. Port defaults to 22, note that the system does not conflict with the port number of a program, the specific settings can be set in Ubuntu;
c. Enter window-->translation in the Remote Character set encoding method to UTF-8 to avoid the Putty Command window in addition to English language garbled phenomenon;
D. Then go back to the session to save for this configuration so that you can log in quickly next time, and finally open.