first, the experimental target
Use 3 virtual machines, build Vmnet2 and Vmnet3 two host-only network, realize interconnection between two networks
second, the experimental environment
|
Intranet |
External network |
Gateway |
| Ip |
192.168.0.10/24 |
202.3.4.10/24 |
Eth0:192.168.0.254/24
Eth1:202.3.4.254/24 |
| Gw |
192.168.0.254 |
202.3.4.254 |
|
third, the experimental steps
1, add VMnet2 and VMnet3, and cancel its DHCP function
2, intranet virtual machine settings
(1) solve the problem of Nic inconsistency, set static IP, subnet mask and gateway for it
[[Email protected] Desktop]# gedit/etc/sysconfig/network-scripts/ifcfg-eth0//edit NIC Information
(2) Add intranet virtual machine to VMnet2
(3) Restart Network Service
[Email protected] Desktop]# service network restart
(4) To see if the IP address of the set is obtained
[[Email protected] Desktop]# ifconfig
2, external network virtual machine settings
Solve the problem of network card inconsistency, set the static IP, subnet mask and gateway for it, and add it to VMnet3, and set up the operation with the intranet virtual machine.
3. Setting up the Gateway virtual machine
(1) Add a network card for the gateway virtual machine, and set its two cards to belong to the networks, add eth0 join Vmnet2,eth1 join VMNET3
(2) solve the problem of inconsistent two NIC, set the static IP, subnet mask and gateway respectively
(3) Turn on forwarding function
[[Email protected] Desktop]# gedit/etc/sysctl.conf//Open System parameters configuration file
[[Email protected] Desktop]# sysctl-p//Make configuration file effective
[[Email protected] Desktop]# servcie iptables stop//temporarily turn off firewall
Iv. test of results
In the intranet virtual machine ping outside the network virtual machine, found that can ping through!
202.3. 4.10
Linux Basic Network Building experiment