Basic Introduction to Linux [Article 8], basics of linux Article 8
Basic Linux network cable
568A
568B
Line sequence: Orange, orange, green, white, blue, white, green, brown, white, brown
Vswitches and vrouters
Switches: DLINK, H3C, CISCO
A Switch is a network device used for electrical signal forwarding. It can provide exclusive electrical signal channels for any two network nodes connected to the vswitch. The most common switch is an Ethernet switch. Other common problems include telephone voice switches and optical fiber switches.
Router: CISCO
A Router is a device connecting LAN and WAN over the Internet. It automatically selects and sets routes based on the channel conditions, and sends signals in the order of the best path.
OSI7 layer Network Model
Physical Layer, data link layer, network layer, transmission layer, Session Layer, presentation layer, and application layer.
TCP/IP:
Data link layer: ARP and RARP
Network Layer: IP, ICMP, and IGMP
Transport Layer: TCP, UDP, UGP
Application Layer: Telnet, FTP, SMTP, SNMP
OSI
Physical Layer: EIA/TIA-232, EIA/TIA-499, V.35, V.24, RJ45, Ethernet, 802.3, 802.5, FDDI, NRZI, NRZ, B8ZS
Data link layer: Frame Relay, HDLC, PPP, IEEE 802.3/802.2, FDDI, ATM, IEEE 802.5/802.2
Network Layer: IP, IPX, AppleTalk DDP
Transport Layer: TCP, UDP, SPX
Session Layer: RPC, SQL, NFS, NetBIOS, names, AppleTalk, ASP, DECnet, SCP
Presentation Layer: TIFF, GIF, JPEG, PICT, ASCII, EBCDIC, encryption, MPEG, MIDI, HTML
Application Layer: FTP, WWW, Telnet, NFS, SMTP, Gateway, SNMP
Protocol
An agreement is an agreement or call rule designed by both parties to achieve communication.
How http works
The three-way handshake of the TCP/IP protocol is closed four times.
How users access the Internet
DHCP Service
NAT Network Address Translation
Private address:
10.0.0.0/8 (10.0.0.0 to 10.255.255.255)
172.16.0.0/12 (172.16.0.0 to 172.31.255.255)
192.168.0.0/16 (192.168.0.0 to 192.168.255.255)
169.254.0.0/16 (169.254.0.0 to 169.254.255.255)
IP address category
Class
1.0.0.0 to 126.0.0.0
0.0.0.0 and 127.0.0 are retained
Class B
128.1.0.0 to 191.254.0.0
128.0.0.0 and 191.0.0 are retained
Class C
192.0.1.0 to 223.0000254.0
Reserved for 192.0.0.0 and 223.255.255.0
Class D
224.0.0.0 to 239.00000000255 for Multi-Point Broadcast
Class E
240.0.0 to 255.255.255.255.254 Reserved
Broadcast 255.255 for broadcast
Website access process
DNS
DNS (Domain Name System)
Oldboy. me >>> 1.1.1.1 requires DNS resolution (the DNS configured on the computer)
What can DNS do?
A record: oldboy. me >>> 1.1.1.1
CNAME: frequently used by CDN service providers
MX resolution record: XXXX@qq.com build mail service
PTR reverse resolution: 1.1.1.1 >>> email service
A record parsing process:
Browser >>> oldboy. me >>> IP address of the website server 1.1.1.1 >>> IP address corresponding to the website Server
DNS resolution process principle
Recursive query> iterative Query
DNS itself is a inverted tree structure, and its vertex is also the root ".".
Root server: 13 servers around the world.
Top-level domain names: org, com, net, me, and cc
Level 1 Domain Name: oldboy, baidu, sina
DNS domain name resolution Query
Dig www.baidu.com
View dns resolution process
Dig@8.8.8.8www.baidu.com + trace
Nslookup
Host www.baidu.com
Ping www.baidu.com
Configure the NIC
Nic profile/etc/sysconfig/network-scripts/ifcfg-eth0
IPADDR = 10.0.0.8 # This is the fixed ip address of the linux server in the local area network (LAN) Bridge Mode.
NETMASK = 255.255.255.0 # subnet mask, used to plan the network bit and host bit, generally 255.255.255.0
GATEWAY = 10.0.0.254 # IP address of the LAN GATEWAY
IPV6INIT = no # whether ipv6 is supported
View the uuid of a disk
Nic effective
Recommended ifdown and ifup
Ifdown eth0 stop eth0 Nic
Ifup eth0 start eth0 Nic
For all NICs
/Etc/init. d/network restart # All NICs
The DNS configured for the NIC takes precedence over/etc/resolv. conf. Restarting the NIC overwrites/etc/resolv. conf.
If no DNS is configured for the NIC, the/etc/resolv. the configuration in conf takes effect. If multiple NICs (DHCP acquisition method) exist, the/etc/resolv may be overwritten. conf.
To modify the Host Name
1. hostname oldboylinux
2. vi/etc/sysconfig/network
3. vi/etc/hosts
Configure the Default Gateway
First effective File
Second effective File
View Gateway
Delete or add a default gateway
Configure and view Network Information
Ifconfig
Alias IP, VIP virtual IP
Ifconfig eth0: x down stop the alias ip address.
Multiple ip addresses are configured as secondary ip addresses.
Secondary ip Format: keepalived High Availability always uses secondary ip
Nic restart alias ip failure, written as the configuration file (/etc/sysconfig/network-scripts/ifcfg-eth0: 1 ).
Lsof
If a port is known to be 333, how can I view the service name corresponding to the port?
Method 1:
Method 2:
View deleted files that are still occupied by processes
Network Check
1. ping www.baidu.com. icmp is disabled in linux. (Whether or not the expressway is accessible)
2. traceroute www.baidu.com-n (tracking Routing) basic check, whether each high-speed node has been repaired
Windows route tracking
Tracert-d www.baidu.com
3. telnet www.baidu.com 80 to check whether the web server is enabled, whether the service is started, and whether the firewall is blocked.
Nmap 10.0.0.25-p 80
Nc
Disconnected:
1. The 80 service is not enabled or the port does not exist.
2. the fw firewall is blocked.
3. The service listening port is not on the connected ip address.
4. ISP is disabled by default. Open a port.
Packet capture tool
Tcpdump
Tcpdump-n icmp-I eth0
Nmap
Windows: wireshark, sniffer, kelai network analysis.