Often found that if we want to get a little gadget or run some small demo, always have to constantly in their work on the computer to build a different operating environment, over time, the books are flooded with various software, speed down, and management is also very inconvenient. So the idea of using virtual machines to build a running environment, one can build different environments, two can be isolated from each other. The next step is to access the virtual machine service in the host:
Preparation environment:
1, the virtual machine installed CentOS, virtual machine using NAT way
2, install the Tomcat service in CentOS, through Ifconfig the IP address is 192.168.131.132, can ping in Windows 192.168.131.132 and use SSH Secure Shell The client can also connect to the CentOS in the virtual machine
3, External System is win7
4, Virtual machine address: 192.168.131.132, host address: 10.147.228.92
Issue one: The Web server in the virtual machine cannot be accessed through http://192.168.131.132:8080 on the host
Workaround:
1. Switch to the root user
2. Enter the following two commands within the terminal
Iptables-f
Iptables-p INPUT ACCEPT (set default Allow rule)
3. Set up a Linux firewall
Add in/etc/sysconfig/iptables-A rh-firewall-1-input-m State--state new-m tcp-p TCP--dport8080-j ACCEPT
Issue two: The Web server in the virtual machine cannot be accessed through http://10.147.228.92:8080 on the host
Workaround:
Set up VMware, port mapping pair, to open 8080 port, VMware's edit->virtual networkeditor->nat (select VMnet8)->edit-> Add mapping host Port:8080,virtualmachine IP address:10.147.228.92,port:8080 in portforwarding
Access to the Web service in the virtual machine