16. Network Management
Five network elements:
MAC address
IP address
Network mask
Gateway
DNS: convert an IP address to a domain name
Ping
Ifconfig
Route
/Etc/resolv. conf
Netstat
IP
NMAP
Run CAT/etc/resolv. conf to view the DNS and obtain the nameserver 192.168.0.1.
Ping Google. Ca. If a packet is returned, it indicates it is successful.
Ping Google. Ca involves six steps:
1. DNS domain name resolution, that is, the number of nameservers obtained in the Command CAT/etc/resolv. conf. Here, the nameserver is 192.168.0.1.
2. Send a DNS request to the Domain Name Server 192.168.0.1.
3. Send Google. CA from DNS to IP address. Here we get 66.249.89.99
4. After obtaining the IP address from Google. ca, place the IP address on the local host to the subnet mask and calculate the IP address, and check whether the local IP address is logged on to the local subnet mask.
66.249.89.99 & 255.255.255.0? = 192.168.0.100 & 255.255.255.0.
To put it bluntly, if you want to send commands to the target, you must first determine whether your subnet is connected.
If they are not equal, the Local Computer and Google. Ca are in the WAN. If they are equal, the Local Computer and Google. Ca are in the LAN. Obviously, the results are not the same, so it is a wide area network.
Only when the destination IP address is 192.168.0.xxx can it be equal.
5. If they are not equal, you must find the Gateway by default. Run the route command to obtain that the default gateway is 192.168.0.1. At this time, the local IP address 192.168.0.100 will send a request to the gateway 192.168.0.1, which requires Ping 66.249.89.99.
6. Get a response from the gateway to the package.
After completing these six steps, you will get the following record:
64 bytes from nrt04s01-in-f99.1e100.net (66.249.89.99): icmp_seq = 1 TTL = 51 time = 57.8 MS
The smaller the time, the faster the link.
Command: route to get the default gateway.
Command: ipconfig to obtain the local IP address and subnet mask.
Sudo ifconfig eth0 down and the network eth0 is heard
Sudo dhclient eth0 is connected to the network again.
Ip addr can also obtain IP addresses.
An Inet 192.168.0.100/24 indicates the IP address and subnet mask. 24 indicates that the subnet mask is 24 BITs, which means 255.255.255.0.
IP Route
Which ports are open to NMAP scanning remote machines. Hacker to common tools. Scan the computers on the network.
22. SSH port.
23 telnet port
CAT/etc/services: view the port relationship. For example:
WWW 80/tcp HTTP # worldwideweb HTTP
WWW 80/udp # Hypertext Transfer Protocol
The above indicates that WWW corresponds to port 80 and HTTP.
You can use grep to filter content for easier search.
CAT/etc/services | grep 22
SSH 22/tcp # SSH remote login Protocol
SSH 22/udp