Linux Virtual Machine network configuration methods and solutions to problems

Source: Internet
Author: User

Linux Virtual Machine network problems
I just installed a vmwarevm and installed a redhat linux operating system on it.
After the installation is complete, the following network is configured.
First, observe the network configuration on windows.
Ip: 192.168.1.109
Nemask: 255.255.255.0
Gateway: 192.168.1.1
Through these things, we can see that the virtual machine should also be in the same network segment (192.168.1.0), the same gateway (192.168.1.1)
The subnet mask should also be 255.255.255.255.0.

There are two preparation methods:
I. Temporary preparation:
Configure ip address and subnet mask
Ifconfig 192.168.1.110 netmast 255.255.255.0
Configure the Default Gateway
Route add default gw 192.168.1.1

Ii. Permanent preparation:
Edit the preparation file. Note that Chinese characters are comments. Remove Chinese characters when editing files.
Vim/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = "eth0" DEVICE name
HWADDR = "00: 24: 1D: 8A: 3D: F7" physical address
ONBOOT = "yes" whether to start
BOOTPROTO = "static" static IP Address can select dhcp
NETWORY = "192.168.1 .. 0" network segment --! Make the same network segment as windows
IPADDR = "192.168.1.110" IP Address
NETMASK = "255.255.255.0" Subnet
GATEWAY = "192.168.1.1" GATEWAY--must be consistent with that on windows

Restart the NIC after preparation
Service network restart
Note that after the preceding command is executed, the network configuration will be performed according to the preparation file.

Iii. Possible Problems in network preparation:
When the preparation is complete and the NIC is restarted to execute service network restart
Failed to disable eth0 Nic
Shutting down interface eth0: Device eth0 has MAC address 00: 0C: 29: AD: 57: 66 instead of configured address 00: 24: 1D: 8A: 3D: F7.
Ignoring [FAILED]
Indicates that the eth0 Nic has a physical address 00: 0C: 29: AD: 57: 66, not the physical location of the preparation.
Address: 00: 24: 1D: 8A: 3D: F7. Ignore.
That is to say, we already have a physical address, so do not randomly configure it in the preparation file.
Therefore, the above preparation HWADDR = "00: 24: 1D: 8A: 3D: F7"
Change to HWADDR = "00: 0C: 29: AD: 57: 66". You can also find it through ifconfig.
Restart the NIC. Everything is OK.

Now the network should be connected, so let's test it.
You can ping the linux Virtual Machine on windows 7. However, linux virtual machines cannot ping windows.
It's strange. What's going on. In general, it may be that the firewall on windows 7 has been blocked.
The solution is to disable the firewall on windows 7 and try again.
You can disable the firewall by running firewall. cpl on run.

Then ping the IP address. Call ~~ Finally solved the problem.
However, to connect to a virtual machine. Is it reasonable to close the firewall directly?
Secure?

========================================
In fact, I am doing a series of work in order to be able to access through putty on windows
Linux on the virtual machine.
Therefore, you need to create an ssh service on linux.
Command service sshd start
And does not want to execute this command every time, so it is in the root ~ /. Bash_profile preparation
File.
You only need to add a line: service sshd start.
Finally, putty can be accessed smoothly. The next time you open the VM, you do not need to configure the network, and you do not need to manually open an ssh service. This is very convenient. Use putty to connect directly to windows ,:)

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.