Before using the network, a basic network configuration is required for the Linux host, which allows the host to communicate with other hosts normally.
First, network configuration
1.IFCFG-ETHN Network configuration file
All network interface configuration files are stored in the/etc/sysconfig/network-scripts directory
The configuration file for the first Ethernet interface of the system is:/etc/sysconfig/network-scripts/ifcfg-eth0
2.netconfig Network Configuration Tool
Netconfig run in the character interface, you can easily configure the network.
Once the network configuration has been completed using Netconfig, only the appropriate network configuration files have been modified and the new properties have not been brought into effect, so restart the network service immediately.
Execute Command: Service network restart//Restart Network Service
Netconfig default configuration Nic eth0, if you need to configure additional network cards, then:netconfig--device eth1//Configure the specified network adapter
3.ifconfig displaying and setting the currently active NIC
(1) Display the currently active network card: ifconfig
(2) Reset the IP address of the network card: Ifconfig network card device name IP address
(3) Set the specified network card to multiple virtual IP addresses, n is the network card number: Ifconfig NIC device name: N IP Address
(4) activating or stopping the specified network card: ifconfig NIC device name Up|down
Ifdown eth0//stop eth0 ifup eth0//Activate eth0
Ifconfig eth0:1 down//Stop eth0:1 ifconfig eth0:1 192.168.1.60 up//Activate eth0:1
4.ping Test Network Connection Status
ping [-c number of messages] destination host address
such as: ping-c 5 192.168.1.60//Send five messages after automatic termination command
Ping 192.168.1.60//Use the CTRL + C key combination to terminate the command and return to the prompt state.
5.ip addr Lists all network cards and their bound IP addresses in the system
Second, network communication
1.write send information in real time
Write username [terminal number]
Message//News body
Ctrl+d//key combination End
2.wall broadcast messages to all users in the system: Wall message
3.MESG settings prohibit and allow messages to be received
MESG//view current message receive status
MESG N//set to prohibit receiving messages
MESG y//set to allow messages to be received
Linux commands (vii)--Network configuration and network communication