Five Elements of the Network: MAC address, IP address, network mask, gateway, DNS
The MAC address is the physical address of the network card. It is globally unique and consists of six bytes.
The IP address is a four-byte logical address allocated to the network card.
The network mask is 32 bytes. Determine whether the IP address is a LAN or a wan. If the IP address is sent by the LAN, the IP address is sent to the gateway.
DNS is a service that converts names and IP addresses.
Network commands
Ping Command. The host sends a packet to an address to check whether the target host can be connected.
The Ping Command works as follows. After you enter the command, the host will obtain the IP address of the target host.
First, the Domain Name Service (DNS) will be called, first find the IP address of your DNS server, and then send a request to the DNS server for IP resolution.
After the DNS finds the answer, it returns a message to the host, telling the host the IP address of the target host requested by the host. the IP address obtained by the host is bitwise AND computed with its own subnet mask. The formula is similar :. xxx. xxx. xxx & 255.255.255.0? = 192.168.5.3 & 255.255.255.0 is equivalent to that of the LAN.
Next, once the host finds that the destination IP address does not belong to the LAN, the host sends the request to the Gateway. The host will view its route table, obtain the gateway address, and then send the request to the gateway.
After the gateway receives a request, view the destination IP address and find the target IP address that the host wants to ping. note: the destination IP address of the request sent by the host is the IP address of the target host, and the destination MAC address is the MAC address of the gateway, so that the gateway can receive the request and perform further processing.
The gateway receives a response and then forwards it to the host. The host prints the response information on the console, including the connection time.
Ifconfig command, Which is equivalent to the ipconfig command in windows.
Ifconfig eth0 down this command breaks the network
Dhclient eth0 this command sends a request to the DHCP server to obtain information about four network elements: IP address, DNS, gateway, and subnet mask.
Route commandTo view the route table and the gateway.
CAT/etc/resolv. confCommand to view the DNS server. nameserver followed by an IP address is dnsserver.
IP commands, This command can view your own IP address, subnet mask,
IP route commandYou can also view IP addresses, gateways, and other information.
NMAP commandWhich can be used to scan the ports opened on the remote machine and the computers on the network.
CAT/ECT/services commandsTo store the ing between different ports. If too much information is difficult to view, you can use the filter to view the command and then add | grep [condition string]