Inux virtual machine network configuration method and solution to the problem

  

Linux virtual machine network problem Just installed a vmware virtual machine, and installed a redhat linux operating system. After the installation, the network was prepared. 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, you can see that the virtual machine should also be on the same network segment (192.168.1.0), the same gateway (192.168.1.1) subnet mask, of course. It should be 255.255.255.0

There are two preparation methods: 1. Temporary preparation: Prepare ip, subnet mask ifconfig 192.168.1.110 netmast 255.255.255.0 Configure default gateway route add default gw 192.168.1.1

Second, permanent preparation: Edit the preparation file, pay attention to Chinese as a comment, when the real editing, the Chinese is removed. 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 can choose dhcp NETWORY="192.168.1..0" 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 - need to be consistent with windows

Restart the network card after the configuration. service network restart Note After executing the above command, the network will be prepared according to the configuration file.

Third, network configuration problems may occur: After the configuration is completed, it is found that restarting the network card to perform service network restart fails to close the eth0 network card. 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] This means that the eth0 NIC has a physical address of 00:0C:29:AD:57:66, not the physical address of the configuration: 00:24:1D:8A:3D:F7. ignore. That is to tell us that there is already a physical address, and the preparation file should not be randomly prepared. So the above configuration HWADDR="00:24:1D:8A:3D:F7" changed to HWADDR="00:0C:29:AD:57:66" can also be found through ifconfig and then restart the network card, everything OK

Now the network should pass, so test it. Found that Windows 7 can ping the Linux virtual machine. But the Linux virtual machine can't ping windows. Very strange, what happened? In general, this may be caused by the firewall opening on Windows 7. The solution is to turn off the firewall on windows 7 and try again. The method of turning off the firewall can be: run the firewall.cpl setting on the run to close.

Then ping again can be pinged. Call ~~ finally solved. However, in order to let the virtual machine communicate with each other. Is it reasonable to close the firewall directly? is it safe?

=========================================================================================== In order to be able to access linux on the virtual machine through putty on windows. So you need to open the ssh service command sshd start on linux and don't want to execute this command every time, so it is prepared in the root ~/.bash_profile configuration file. Just add a line: service sshd start. Finally, putty smoothly access, the next time you open the virtual machine, you do not need to re-configure the network, you do not need to manually open the ssh service, it is very convenient. Connect directly with putty on windows, :)

Copyright © Windows knowledge All Rights Reserved