Expand knowledge of network operation and maintenance
Domain name and IP address
It consists of a string of names separated by dots, www.abc.com com; Is the alias of the IP address for easy memory.
Port number
Computers on the network can be found through IP addresses. Through the port number, you can find the program running on the computer.
Access domain name
We can use the ping command to try to access the web address:
$ ping www.baidu.com PING www.a.shifen.com (36.152.44.95): 56 data bytes 64 bytes from 36.152.44.95: icmp_seq=0 ttl=56 time=11.452 ms 64 bytes from 36.152.44.95: icmp_seq=1 ttl=56 time=16.187 ms 64 bytes from 36.152.44.95: icmp_seq=2 ttl=56 time=12.856 ms ^C --- www.a.shifen.com ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 11.452/13.498/16.187/1.986 ms
We can try to use this IP to access it in the browser:
Therefore, we usually use the domain name to access the web address, that is, the alias of the IP address, otherwise it is too difficult to remember.
We can disassemble the process of accessing domain names / websites: 1) the local computer transmits the access instructions to the remote computer; 2) The remote computer is equipped with a WEB server. After entering the address, we also need to set a port, that is, the port number mentioned above, to tell the remote computer that we need to access the software equipped with the WEB server, which provides the visitors with the content they need to access; 3) The local computer obtains the remote computer data and loads the WEB page you want to visit.
Usually, if we do not specify a port, the default port will be used. For example, Using ssh, the default is 22, and accessing the web server, the default is 80.
If we give the wrong port, the required services cannot be accessed normally:
SSH
ssh, the full name of secure shell (SSH), is a software program that connects to a remote computer using a protocol.
SSH is currently relatively reliable and provides security protocols for remote login sessions and other network services.
In Mac OS, Ubuntu and Linux, we can use them directly through the terminal:
Transmitting the designation of the client to the server through the network; After the server executes the instruction, it returns the result to the client through the network. Realize the use of remote.
image.png
We can try ssh to remotely access our own server, or we can create a virtual machine and use the local computer to access the virtual machine. For authorization information, select yes:
$ ssh mugpeng@192.168.130.128 -p 22 The authenticity of host '192.168.130.128 (192.168.130.128)' can't be established. ECDSA key fingerprint is SHA256:uQKHuYrukuWxYAmR7owG6f+Xz7q2KD6a+lgxXbfLy6c. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.130.128' (ECDSA) to the list of known hosts. mugpeng@192.168.130.128's password: Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.8.0-41-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage 243 updates can be installed immediately. 24 of these updates are security updates. To see these additional updates run: apt list --upgradable Your Hardware Enablement Stack (HWE) is supported until April 2025. *** System restart required *** The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. # You're in mugpeng@mugpeng-virtual-machine:~$ ls Desktop Documents Downloads Music Pictures Public snap Templates Videos mugpeng@mugpeng-virtual-machine:~$
SCP
Its essence is a remote copy command. You can understand it as copy and paste between servers.
image.png
The port can also be written as - oPort =.
Server usage scp Download and upload • download scp -oPort=6652 user@120.77.173.108:/path/filename /home/folder • upload scp -oPort=6652 /home/filename user@120.77.173.108:/path/folder
You can also specify the - r parameter to download or upload folders (traverse files).
It's just that the code is a little troublesome:
$ scp -r ~/Desktop appe@192.168.1.6:~/Desktop Password: test1.txt 100% 0 0.0KB/s 00:00