What configuration items do I need to configure to access the Linux host to the network?
Ip/netmask: Local communication.
Routing (Network Management): cross-network communication.
DNS server address: Host-name-based communication.
There are three types of DNS servers: primary/Standby DNS server/third backup DNS server.
The DNS server specifies that the configuration file needs to be modified/etc/resolv.conf
Hostname configuration: Modify/etc/sysconfig/network. CENTOS7 can be modified using the HOSTNAMECTL command.
Hostname command:
View: hostname
Configuration: hostname hostname. Invalid after temporary effective restart.
Hostnamectl Command (CENTOS7):
Hostnamectl Status: Displays the current hostname information
Hostnamectl set-hostname: Sets the hostname, permanently valid.
Configuration file:/etc/sysconfig/network
Hostname=
Configuration mode: Static assignment, dynamic acquisition.
Static designations are primarily used with the Ifcfg Family command, and the Iproute2 command.
Ifcfg
Ifconfig: Configuring IP and Netmask
Route: Configure Routing
Netstat: status and Statistics view
Iproute2:
IP OBJECT:
Addr: Address and mask
Link: interface
Route: Routing
SS: Status and Statistics view
Network configuration command on CENTOS7: NM (Networks Manage)
NMCLI: command-line tools
Nmtui:text Windows Tools
IFCFG Family command Detailed: Ifconfig,route,netstat
Ifconfig command: interface and address view and management. Functions are equivalent to IP addr and IP link in iproute2.
Ifconfig [INTERFACE]
Ifconfig: Default does not follow the parameter, only the interface that shows the activation state.
Ifconfig-a: Displays interfaces for all interfaces, including the inactive state.
Ifconfig interface [Aftype] options | Address
Options:
Up: Enable interface
Down: The interface is closed, IP and mask cannot be omitted when used.
Add: For adding an IPV6 address.
Del: Used to delete an IPV6 address.
Route command:
View:
Route-n
Add to:
Route add [-net|host] target [netmask Nm] [GW GW] [[Dev] If]
-net: Network Routing
-host: Host Routing
Target: Destination Address
Netmask Nm: Subnet mask for destination address
GW GW: Gateways
Add a default route: Route add default GW 192.168.3.254
Delete:
Route del [-net|-host] target [netmask Nm] [GW GW]
Delete default route: Route del Default
Netstat command:
Print network connections,routing tables,interface statistics,masquerade connections,and Multicast memberships (Printing Internet connection , routing tables, interface statistics, spoofing connections, and multicast members)
Show routing table: Netstat-r n
-R: Show kernel routing table
-N: Number format
Show Network Connections:
netstat [--tcp|-t] [--udp|-u] [--udplite|-u] [--sctp|-s] [--raw|-w] [--listening|-l] [--all|-a] [--numeric|-n] [-- EXTEND|-E] [--program|-p]
-T:TCP protocol-related connections. TCP is connected by a state.
-U:UDP related connections. Stateless connection.
-w:raw socket-related connections.
-L: The connection is in the listening state.
-A: All state connections.
-N: Displays IP and port in numeric format.
-P: Show related processes and PID
-E: Extended format displays details
Supplemental: TCP is a connection-oriented protocol that establishes a virtual link before the communication begins and the UI is removed after the communication is complete. The DUP has no connection protocol and sends data messages directly.
Display statistics for the interface:
netstat {--interface |-i |-i} [iface] [--all |-a] [--extend |-e] [--verbose |-v] [--program |-P] [--numeric | -N]
All interfaces:
Netstat-i
Specify the interface:
Netstat-i<iface>
linux--Network Configuration (IFCFG)