Linux basic network construction experiment, linux Basic Construction
I. Lab Objectives
Use three virtual machines to build two host-only networks: vmnet2 and vmnet3.
Ii. experiment environment
|
Intranet |
Internet |
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 |
|
Iii. Experiment steps
1. Add VMnet2 and VMnet3 and disable their DHCP functions.
2. Intranet Virtual Machine Settings
(1) Solve the Problem of inconsistent network interfaces, and set static IP addresses, subnet masks, and gateways for them.
[Root @ lyy desktop] # gedit/etc/sysconfig/network-scripts/ifcfg-eth0 // edit Nic Information
(2) add an intranet Virtual Machine to VMnet2
(3) restart the network service
[Root @ lyy desktop] # service network restart
(4) check whether the configured IP address is obtained.
[Root @ lyy desktop] # ifconfig
2. Internet Virtual Machine Settings
To solve the problem of inconsistent network adapters, set static IP addresses, subnet masks, and gateways for them, and add them to VMnet3 to perform operations on the same settings as those for Intranet virtual machines.
3. Gateway Virtual Machine Settings
(1) Add a network card for the gateway virtual machine, set the network of the two cards, and add eth0 to VMnet2 and eth1 to VMnet3.
(2) solve the inconsistency between the two NICs by setting static IP addresses, subnet masks, and gateways respectively.
(3) Enable the forwarding function
[Root @ lyy desktop] # gedit/etc/sysctl. conf // open the system parameter configuration file
[Root @ lyy desktop] # sysctl-p // make the configuration file take effect
[Root @ lyy desktop] # servcie iptables stop // temporarily disable the Firewall
Iv. Result Testing
Ping the Internet virtual machine on the Intranet virtual machine and you can Ping it!
[Root @ lyy desktop] # ping 202.3.4.10