Linux network configuration, common commands and remote tools

1.The most commonly used commands and directory structure of Linux

Commonly used commands:

ls: List the files and subdirectories of the current directory.
cd: Change the current working directory.
pwd: Displays the path of the current working directory.
mkdir: Create a new directory.
rm: Delete a file or directory.
cp: Copy files or directories.
mv: Move files or directories, and can also be used to rename files or directories.
cat: Display file contents.
grep: Search a file for lines matching a specified pattern.
chmod: Modify the permissions of a file or directory.
chown: Modify the owner of a file or directory.
chgrp: Modify the group to which a file or directory belongs.
tar: Packs or uncompresses files and directories.
ssh: Remotely log in to another computer through the SSH protocol.

Directory Structure:

/: Root directory, the starting point of the entire file system.
/bin: Stores executable system commands.
/boot: Stores files required for startup, such as the kernel and boot loader.
/dev: Device file directory, containing files corresponding to device drivers.
/etc: stores system configuration files.
/home: The user's home directory, each user has an independent subdirectory.
/lib: Stores system shared library files.
/media: Mount point for mounting removable media such as USB flash drives.
/mnt: The mount point used to temporarily mount the file system.
/opt: Stores optional software packages.
/proc: Special directory that provides information about running processes.
/root: The home directory of the super user (root).
/sbin: Stores system commands used by system administrators.
/tmp: Temporary file directory, where temporary files are stored.
/usr: Stores shareable read-only data and programs, similar to program folders.
/var: stores variable data files, such as log files, queue files, etc.

2. Detailed explanation of Linux network connection mode and IP address configuration

Common network connection modes:

Ethernet connection: Connect to the local network or the Internet via the Ethernet interface. Ethernet connections use physical hardware devices (such as network cards) and the TCP/IP protocol stack.
Wireless network connection: Connect to a wireless network through a wireless network card. Common protocols used for wireless network connections include Wi-Fi (wireless LAN) and cellular networks (such as 4G, 5G networks).
Virtual Private Network (VPN) connection: Connects remote networks over the Internet, providing secure data communication. Common VPN protocols include OpenVPN, IPsec, etc.
Virtual LAN (VLAN) connection: Splitting a physical local area network (LAN) into logically independent virtual LANs enables isolation and communication between different subnets.

Common network connection modes for virtualized environments:

Bridge Mode: Bridge mode is one of the most commonly used virtualization network connection modes. It connects the virtual machine's network interface and the physical network interface to communicate directly with the network. The virtual machine communicates with the external network through the physical network interface, so that it can run like a real device.
NAT mode (Network Address Translation Mode): NAT mode is a network connection mode in a virtualized environment. The virtual machine uses a NAT network interface to connect to the virtual network, allowing access to the external network but being hidden from the external network. NAT mode can be used for virtual machines to access external networks while hiding the real IP address of the virtual machine.
Host-Only-Network: Host-only mode allows a virtual machine and the host to share a virtual network and not communicate with other virtual machines or physical networks. It does not need to expose the network interface to the outside world and can enhance the security of the virtual machine.

IP configuration:

Static IP address configuration: Manually specify network configuration parameters such as IP address, subnet mask, gateway, and DNS server. In Linux, you can edit network configuration files (such as /etc/network/interfaces or /etc/sysconfig/network-scripts/ifcfg-*) to set a static IP address.
Dynamic Host Configuration Protocol (DHCP): Automatically assigns IP addresses and other network configuration parameters through a DHCP server. In Linux, you can use a DHCP client such as dhclient or the dhcpcd command to obtain a dynamically assigned IP address.
Network Manager: It is a common network connection management tool in Linux. It can configure IP addresses through its graphical interface or command line interface. It supports static IP addresses, DHCP, and other advanced network configuration options.
Note:
An IP address consists of four numbers between 0 and 255, usually expressed in the form of "XXX.XXX.XXX.XXX". Among them, the first three numbers represent the network address, and the last number represents the host address. IP addresses can also be divided into public addresses (used on the Internet) and private addresses (used on internal LANs).
Subnet mask (used to determine the boundaries between networks and hosts in IP addresses), gateways (relay devices between networks), and DNS servers (used for domain name resolution)
To configure an IP address, you usually need to have root privileges or use the sudo command.

3. Use of remote connection tools XShell, SSH, CRT, etc.

Remote connection tools:

Software used to establish secure remote connections between a local computer and a remote computer. These tools typically use the SSH protocol for encryption and authentication to ensure the security of data transfers.

XShell: XShell is a commonly used SSH (Secure Shell) client software that supports Windows platforms. It provides a graphical interface to connect to remote hosts and execute commands. XShell also has some other functions, such as file transfer and tunnel settings.
SSH: SSH is a network protocol used to securely connect to a remote host remotely over an insecure network. In addition to the command line interface, SSH can also transfer graphical applications through a graphical interface (such as X11 forwarding).
CRT: CRT (VanDyke SecureCRT) is a powerful terminal emulator and SSH client software. It provides a multi-tab interface to manage and access multiple remote sessions simultaneously. CRT also has advanced features such as script automation, file transfer, and session management.

Instructions:

1. Download and install: Download and install the required remote connection tools from the official website.
2. Start the software: Open the software and create a new connection configuration (usually you need to specify the IP address, username and password of the remote host).
3. Connect to the remote host: Fill in the relevant information of the remote host in the connection configuration and click the Connect button. The software will connect to the remote host via SSH protocol.
4. Authentication: During the connection process, you may be required to authenticate, enter the corresponding username and password (or use other authentication methods, such as SSH keys).
5. Remote session: After the connection is successful, you will be able to execute commands in the terminal interface and access the file system of the remote host, etc.

4.How to restart network service in Linux

Network services can be managed using the systemctl command as follows:
Restart network service: sudo systemctl restart network.service
Or use the network manager: sudo systemctl restart NetworkManager.service

5. Detailed explanation of Linux firewall shutdown command

1. First check which firewall software package is (ufw, firewall and iptables)
Ubuntu system: dpkg -l | grep corresponding firewall software package
CentOS system: rpm -qa | grep corresponding firewall software package
2. Command to turn off the firewall:
(1) Applicable to Linux systems using iptables as a firewall:
Turn off the firewall permanently: sudo systemctl stop iptables or sudo service iptables stop
Temporarily turn off the firewall: sudo systemctl mask iptables or sudo service iptables mask
(2) Applicable to Linux systems using firewalld as a firewall:
Turn off the firewall permanently: sudo systemctl stop firewalld or sudo service firewalld stop
Temporarily turn off the firewall: sudo systemctl mask firewalld or sudo service firewalld mask
(3) Applicable to Ubuntu and Debian systems using ufw as firewall:
Turn off the firewall permanently: sudo ufw disable
Temporarily turn off the firewall: sudo ufw --force disable

6.Linux network configuration and virtual network card problem solutions

1. Restart the network service: sudo systemctl restart networking or sudo service networking restart
This will restart the network service and may help resolve some network configuration issues.
2. Check the network interface configuration:
Use the following command to view the configuration of the current network interface: ifconfig -a
Make sure the network interface is configured correctly, including IP address, subnet mask, gateway, etc.
3. Check network connection:
Use the following command to check whether the network connection is normal: ping <destination address>
If you cannot ping the target address, there may be a network connection problem.
4. Virtual network card configuration:
- If you use virtualization software (such as VirtualBox, VMware), please ensure that the network adapter settings of the virtual machine are correct, including network connection type (bridge, NAT, etc.), MAC address, etc.
- If you use network namespace or container technology (such as Docker, LXC), please ensure that the relevant network configuration is correct.
5. Check firewall settings:
If you are experiencing network connection issues, your firewall settings may be blocking certain network traffic. Please check the firewall rules and make sure the required network traffic is allowed.
6. Check the network configuration file:
In Linux, network configuration files are usually located in the /etc/network/interfaces or /etc/sysconfig/network-scripts directories. Check these configuration files to ensure that the network configuration is configured correctly. Varies depending on the Linux distribution used.

Supongo que te gusta

Origin blog.csdn.net/weixin_61275790/article/details/134467873
Recomendado
Clasificación