Network management and process management

Source: Internet
Author: User

1. The OSI seven-layer model and the TCP/IP five-layer model
    • OSI is an open system interconnection established by ISO organization, and the OSS Interconnect protocol
    • Lower level services for the upper layer
    • Sender from upper to lower package
    • The receiver is encapsulated from lower to upper
    • Layer 7th Application Layer: Services for applications, integrated in applications
    • Layer 6th Presentation layer: Data representation formats supported by both parties, integrated in the application
    • Level 5th Session Layer: Connect sessions between applications, integrated in the operating system
    • Layer 4th Transport Layer: TCP/UDP protocol, using port number to locate application, 1-65535, data slice, package segment header
    • Layer 3rd Network layer: Ipv4/ipv6 protocol, the router uses IP address to uniquely identify the network node for inter-network data Routing and forwarding, package packet header
    • Layer 2nd Data Link Layer: Ethernet protocol, the switch uses the MAC address to uniquely identify node within the network for intra-network data forwarding, encapsulating the data frame head and frame end.
    • Layer 1th Physical layer: 568B line sequence, specify interface size, cable size, convert data frame to physical signal
    • TCP/IP has a 1th layer of physical layer, corresponding to the OSI 1, 2nd layer for the Data link layer, corresponding to OSI2, 3rd layer Network layer, 4th Layer Transport layer, 5th Layer application layer, corresponding to osi5-7
2, brief Iproute family Order iproute2 Family command Ipip link
    • IP link Set DEV down/up
    • IP link Show
    • Multicast on/Off
    • MTU Number Setting MTU
    • Netns Nsname Move to namespace
IP netns
    • IP Netns List View namespace
    • IP netns Add namespace
    • IP netns del Delete namespace
    • IP netns exec name COMMAND executes the network within the namespace
IP addr
    • IP addr Add ifaddr dev IFACE label Interface alias
    • IP addr Delete deletion
    • IP Addr Show view
    • IP addr Flush DEV IFACE Empty
IP route
    • Add Type/prefix via GW dev face src source_ip
    • Change replace
    • Delete Deletes
    • Show
    • Get a single entry
    • Flush Empty
[[email protected] ~]# IP addr Add 192.168.1.9/24 dev eth0 label eth0:0[[email protected] ~]# IP addr1:lo: <    Loopback,up,lower_up> MTU 65536 qdisc noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 Scope host lo inet6:: 1/128 scope host Valid_lft forever Preferred_lft Forever2:eth0: <broa Dcast,multicast,up,lower_up> MTU Qdisc Pfifo_fast State up Qlen, Link/ether 08:00:27:94:b7:d0 BRD ff:ff:ff:    Ff:ff:ff inet 192.168.1.8/24 BRD 192.168.1.255 scope global eth0 inet 192.168.1.9/24 scope Global Secondary eth0:0  Inet6 fe80::a00:27ff:fe94:b7d0/64 scope link Valid_lft forever preferred_lft forever[[email protected] ~]# IP  Addr Delete 192.168.1.9/24 dev eth0[[email protected] ~]# IP addr1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 Qdisc  Noqueue State UNKNOWN link/loopback 00:00:00:00:00:00 BRD 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo Inet6     :: 1/128 Scope Host  Valid_lft Forever preferred_lft Forever2:eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State Up Qlen link/ether 08:00:27:94:b7:d0 brd ff:ff:ff:ff:ff:ff inet 192.168.1.8/24 BRD 192.168.1.255 Scope Global E Th0 inet6 fe80::a00:27ff:fe94:b7d0/64 Scope link Valid_lft forever preferred_lft forever[[email protected] ~ ]# IP route add 192.168.1.7 via 192.168.1.9 Dev eth0:0[[email protected] ~]# ip route del 192.168.1.7[[email pro tected] ~]# ip route192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.8169.254.0.0/16 dev eth0 scope link MetR IC 1002default via 192.168.1.1 Dev eth0
Ss
    • option is the same as Netstat
    • Status filter: 1.state 2.( dport = :22 )
[[email protected] ~]# ss-np State "listening" Recv-q send-q Local address:port Peer address:port0 128 192.168.1.8:22 *:* Users: (("sshd", 1347,3) 0:: 1:25:::* Users: (("Master", 1426,13) 0 127.0.0.1:25 *:* Users: (("Master", 1426,12) ) [[email protected] ~]# SS-NP State "established" Recv-q send-q Local address:port Peer address:port0 64 192.168.1.8: 192.168.1.2:54516 Users: (("sshd", 1581,3) [[email protected] ~]# ss-tunlpnetid State recv-q send-q Local Address :P ort Peer address:porttcp LISTEN 0 192.168.1.8:22 *:* Users: (("sshd", 1347,3)) TCP LISTEN 0:: 1:25:::* Users: (("Ma Ster ", 1426,13)) TCP LISTEN 0 127.0.0.1:25 *:* Users: ((" Master ", 1426,12)) [[email protected] ~]# Ss-tunapnetid State recv-q send-q Local address:port Peer address:porttcp LISTEN 0 192.168.1.8:22 *:* Users: (("sshd", 1347,3)) TCP LIS  TEN 0:: 1:25:::* Users: (("Master", 1426,13)) TCP LISTEN 0 127.0.0.1:25 *:* Users: (("Master", 1426,12)) TCP Estab 0 64 192.168.1.8:22 192.168.1.2:54516 Users: (("sshd", 1581,3)) [[email protected] ~]# ss-tunpnetid State recv-q send-q Local address:port Peer Address:po  Rttcp estab 0 192.168.1.8:22 192.168.1.2:54516 Users: (("sshd", 1581,3)) [[email protected] ~]# ss-tunap ' (sport = : () ' Netid State recv-q send-q Local address:port Peer address:porttcp LISTEN 0 * 192.168.1.8:22 *:* Users: (("sshd", 13 47,3)) TCP estab 0 192.168.1.8:22 192.168.1.2:54516 Users: (("sshd", 1581, 3)

3, detailed instructions for management tools Htop, Vmstat and other related commands, and examples

Htop
    • Top of the upgrade version
    • List of files opened by the L:lsof trace process
    • S:strace Tracking System Call
    • T: Hierarchical relationship
    • A:affinity CPU affinity, binding program running CPU core
Vmstat
    • Vmstat 2 3: Interval seconds, number of runs
  [[email protected] ~]# vmstat 1 10procs-----------memory-------------Swap-------io-----system----- ---CPU-----r b swpd free buff cache si so bi bo in CS us sy ID WA St 1 0 0 355264 2076 87016 0 0 41 3 43 42 0 0 99 1 0 0 0 0 355264 2076 87016 0 0 0 0 70 60 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 62 57 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 56 51 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 69 61 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 61 50 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 2 75 68 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 64 50 0 0 100 0 0 0 0 0 355240 2076 87016 0 0 0 0 (0 0) 0 0 0 0 0 355240 2076 87016 0 0 0 0 (0 0) 0 0  
    • Procs
      • R: Queue Length waiting to run
      • B: Task queue Length in non-disruptive sleep state blocked
    • Memory
      • Swap
      • Free
      • Buffer
      • Cache
    • Swap
      • Si: The rate at which data is swapped into swap, kb/s
      • So: Data swap swap rate, kb/s
    • Io
      • BI: Rate of read-in to memory from a block device
      • Bo: The rate of writing from memory to a block device
    • System
      • In:interrupt Interrupt Rate
      • Cs:context Switch Context Switching rate
    • Cpu
      • us
      • Sy
      • Id
      • Wa
      • St
    • Vmstat-s Display Memory Details
4, using until and while respectively to achieve 192.168.0.0/24

In the network segment, whether the address can ping, if the ping general output "success!", if the ping is not general output "fail!"

[[email protected] ~]# cat pingwhile.sh#!/bin/bash# description: 测试192.168.0.0/24网段是否能ping通# author: xuluchuan# version: 1.0# date: 20180623declare -i i=1while [ $i -le 254 ]; do    ip="192.168.0.$i"    ping -c 3 -w 3 -W 3 $ip &> /dev/null    if [ $? -eq 0 ]; then        echo "ping $ip successful"    else        echo "ping $ip fail"    fi    let i++done[[email protected] ~]# cat pinguntil.sh#!/bin/bash# description: 测试192.168.0.0/24网段是否能ping通# author: xuluchuan# version: 1.0# date: 20180623declare -i i=1until [ $i -gt 254 ]; do    ip="192.168.0.$i"    ping -c 3 -w 3 -W 3 $ip &> /dev/null    if [ $? -eq 0 ]; then        echo "ping $ip successful"    else        echo "ping $ip fail"    fi    let i++done

Network management and process management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.