Configure the network in linux
Configure network 1. Enable Virtual Network
Click Change adapter settings in the left-side Navigation Pane:
Enable Vmware Virtual Network 1 and network 8
2. Set the network type of the VM to bridging mode (important)
Disable the VM, set the network type to bridging mode, and then start the VM.
3. Use the vi editor to configure the Virtual Machine Network
File Path:/etc/sysconfig/network-scripts/ifcfg-eth0: configuration information for the first Nic
After opening the file, the effect is as follows:
DEVICE: DEVICE Name
ONBOOT: After the system starts, whether or not the Nic starts. yes: Start, no: Disable
BOOTPROTO: Network Acquisition Method (automatically obtained by dhcp and manually configured by static)
IPADDR: IP Address
NETMASK: Subnet Mask 255.255.255.0
GATEWAY: Default GATEWAY (associated with vro)
HWADDR: the mac value of the NIC. It is fixed. Each Nic has a unique mac address.
4. Configure the PHP server network
What if I get the Virtual Machine address? A: In the cmd window, run the ping command to ping an IP address. If the IP address cannot be pinged, no other user can use it. Therefore, you can set this network.
Unavailable cases:
Use Cases:
In Linux, the settings are as follows:
Save and exit, and then restart the network through the service, ifup, and ifdown commands.
5. Restart the service command
- Service network (service name) start | stop | restart | status (recommended)
- Ifup (dedicated For nic startup)
- Ifdown (dedicated For nic shutdown)
Example 1: use the service to restart the NIC service
Example 2: Use ifup and ifdown to restart the NIC Service
6. view the NIC address and clear it
In Linux, you can use the ifconfig command to view the network IP address acquisition status.