1, explain the basic concept of computer network
TCP/IP Layer four protocol
Application layer HTTP FTP CIFS SSH
Transport Layer Port number TCP/UDP
Network layer IPV4 and IPV6 IPv4 32bit
Data Link Layer MAC address 48bit
IP Address: 172.17.5.3 172.25.5.3 172.25.5.4
255.255.0.0 255.255.255.0 255.255.255.0
Subnet mask function distinguishes between network bit and host bit
(1) network bits are used to differentiate different networks;
(2) The host bit is used to distinguish a network, different host number;
Use a prefix to represent the subnet mask for an IP address
172.25.5.3/16
172.25.0.11/24
In one network, the first IP address and the last IP address cannot be used
192.168.1.0/24 represents the network address
192.168.1.255/24 means broadcast address
Gateway: Refers to the router address in this network
Enables communication between different networks
Gateway: The data export of this network, its address must be the same network with its own IP address
For example: 192.168.1.1/24 its gateway can be specified as 192.168.1.254
DNS: Domain Name System role: dedicated to resolving domain names to IP addresses
dns:8.8.8.8 114.114.114.114 61.128.128.68
? 2. Testing and reviewing current infrastructure network configuration
Other Linux versions ifconfig view port status
IP addr View port status
IP Route Query Routing table
Ping 172.25.0.11
Ping uses ICMP protocol, ECHO echo-reply message
/ETC/RESOLV.COMF DNS Server configuration file
NameServer 172.25.254.254 is the DNS server address
? 3. Manage nmcli and install network settings and devices
TRACEPATH 172.25.0.254 Tracking Network path
TRACEROUTE 172.25.0.254 Tracking Network path
Ip-statistics Link Show eth0 View information about eth0 NIC data traffic
NETSTAT-ANUTP to see which ports are open in the device
-A All
-N Name
-U UDP
-T TCP
-P Protocol
SS-ANUTP |grep 22
—————————————————————————————————————
RHEL7 Mandatory use of NMCLI
NetworkManager the process of monitoring and managing the network
Configuration file path for the NIC/etc/sysconfig/network-scripts
It is not recommended to modify the configuration file directly and use the NMCLI command to modify it.
Nmcli Enter, view usage
Conncetion device general help networking Radio
NMCLI Device Show lists all network adapter devices and details
NMCLI Device status Lists all network card devices
Latest network adapter naming rules:
En Pls0 Ethernet
Wl WLAN Wireless Card
Ww WWAN
P1 first slot for PCI
O1 the first slot of the S0 integrated network card
BR0 Virtual network card
The system does not know which type to use eth0
NMCLI Connection
DEVICE TYPE State CONNECTION
Eth0 Ethernet Connected System eth0
Create your own connection to replace each other's conncection
NMCLI connection Show Show all connections
NMCLI Connection Show "System eth0" shows conncection status for system eth0
Add a new conncection configuration IP address
NMCLI connection Add con-name static ifname eth0 type Ethernet IP4 172.25.0.11/24 gw4 172.25.0.254 Add name of connection connection
Con-name is the name of connection representative.
IfName is the device name.
Type is representative of the NIC types
NMCLI Connection Show--active view active connections
NMCLI connection show static to see if specific information in static is correct
Switch the connected connection device
NMCLI connection Modify "System Etth0" Connection.autoconnect No
' Turn off automatic connection at next startup
NMCLI connection Modify Static Connection.autoconnect Yes
Turn on automatic connection on next startup
*nmcli Connection Modify static Ipv4.method manual
Use static IPV4 address for next boot
**NMCLI connection Modify Static Ipv4.dns 172.25.0.254
Set up DNS
NMCLI connection Down "system eth0"
A net card, configure multiple IP addresses
NMCLI Connection Modify static + ipv4.addresses "192.168.0.11/24 192.168.0.254"
NMCLI Connection Reload Reload configuration file
Reload not successful
NMCLI connection static up uses static up
NMCLI connection Modify static +ipv4 DNS 8.8.8.8
NMCLI connection static up
NMCLI device Static Show
Connection Show/add/delete/modify
Connection Up/down/reload Static
? 4. Modify the network settings by editing the configuration file
[Email protected] ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0 type=ethernet #网卡类型 device=eth0 #网卡接口名称 onboot=yes #系统启动时是否自动加载 bootproto=static #启用地址协议 –static: Static protocol –BOOTP Protocol –DHCP protocol ipaddr=192.168.1.11 #网卡IP地址 netmask=255.255.255.0 # Nic Network address gateway=192.168.1.1 #网卡网关地址 dns=10.203.104.41 #网卡DNS地址 hwaddr=00:0c:29:13:5d:74 #网卡设备MAC地址 broadcast= 192.168.1.255 #网卡广播地址
? 5. Configuration and test system hostname and domain name resolution
Hostname machine-corresponding host name server0.example.com
ping hostname
Set host name
Hostnamectl Set-hostname setver100.example.com
Hostname Chen's order of provisional effect
/etc/hosts hostname configuration file location can be modified by modifying the configuration file
Check the/etc/hosts file first, if the hosts file does not find the corresponding domain name, will go to find DNS
/etc/resolv.conf the configuration file location of the DNS, which can be modified by modifying the configuration file
DNS modifications are also recommended to be modified using the Nmcli method
Linux 124 Course 11, network management