linux常用指令
- 1.页相关
- 页大小
- 2.系统参数
- 3.启动参数
- 4.网络参数
- 查询网卡所属numa节点信息
- 网络测速相关
- iperf测试
- sar监控网卡流量
- 查看网卡txqueuelen和mtu
- 抓包tcpdump
- 网络数据收发状态
- snmp协议栈
- netstat -i所有网口TX-OK、RX-OK
- netstat-s查看各个协议的收发数据
- ethtool -S单个网口的收发包详细数据
- ethtool查看网卡配置
- ethtool -K设置流控属性
- ethtool -L设置多队列
- ethtool -G查看ringbuffer
- ethtool -i enaftgm1i0 查看驱动版本
- 网络查表
- arp
- 路由表
- conntrack表
- 5.软件包
- dpkg查找可执行文件所在软件包名
- rpm查找可执行文件所在软件包名
- 解压rpm包指令
- 查询某个可执行文件所在目录
- 6.DNS相关
- DNS域名解析服务--Named服务
- dns解析过程
- dig域名查询工具
- nslookup域名查询工具
- tcpdump抓取dns数据包
- 7.CPU相关
- 绑核taskset与核隔离
1.页相关
页大小
getconf PAGESIZE
获取当前系统内核页大小
2.系统参数
sysctl -a查看系统参数
sysctl -w net.ipv4.ip_forward=1修改系统参数(掉电重启后配置无效)
sysctl -p 文件位置,会从指定文件读取系统参数来修改
如果需要重启后仍生效,需要将配置添加到/etc/sysctl.conf
3.启动参数
cat /proc/cmdline查看启动时内核配置的参数
可以修改loglevel、audit等配置
loglevel改为8时输出级别最低,所有的内核信息都能打印
4.网络参数
查询网卡所属numa节点信息
详见:Linux系统网卡所属numa节点信息查询方法
网络测速相关
iperf测试
服务端 iperf -s -u -B 232.55.2.1 -i 1
-B:–bind host,指的是绑定后面跟着的ip,用了-B参数,iPerf会越过主机ip地址和物理网卡的绑定关系,会用-B参数指定的IP地址发送数据
客戶端 iperf -c 232.55.2.1 -u -ttl 5 -t 600 -b 100M -i 1
-u -b 100M表示发送端使用udp协议以100Mbps的带宽发送数据。
-l :–length,设置要发送的包的长度。包的长度必须在4字节到(65535-20-8)字节之间,因为以太网数据帧的最大有效负载是1500字节,而TCP和UDP头部大小分别是20和8字节。
sar监控网卡流量
sar -n DEV 1 3,每秒输出一次,一共显示3次
sujing@sujing-GW-001N1B-FTF:~$ sar -n DEV 1 3
Linux 5.4.18-30.16-gfb02-ky10-generic (sujing-GW-001N1B-FTF) 2024年01月25日 _aarch64_ (4 CPU)15时56分51秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
15时56分52秒 ip6tnl0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分52秒 sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分52秒 enaftgm1i0 15.00 8.00 1.03 0.59 0.00 0.00 0.00 0.00
15时56分52秒 wlp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分52秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.0015时56分52秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
15时56分53秒 ip6tnl0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分53秒 sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分53秒 enaftgm1i0 21.00 14.00 2.32 7.46 0.00 0.00 0.00 0.01
15时56分53秒 wlp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分53秒 lo 9.00 9.00 2.43 2.43 0.00 0.00 0.00 0.0015时56分53秒 IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
15时56分54秒 ip6tnl0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分54秒 sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分54秒 enaftgm1i0 15.00 13.00 1.69 5.46 0.00 0.00 0.00 0.00
15时56分54秒 wlp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
15时56分54秒 lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00平均时间: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s %ifutil
平均时间: ip6tnl0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: sit0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: enaftgm1i0 17.00 11.67 1.68 4.50 0.00 0.00 0.00 0.00
平均时间: wlp6s0 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
平均时间: lo 3.00 3.00 0.81 0.81 0.00 0.00 0.00 0.00
sujing@sujing-GW-001N1B-FTF:~$
IFACE:就是网络设备的名称;rxpck/s:每秒钟接收到的包数目 txpck/s:每秒钟发送出去的包数目
rxbyt/s:每秒钟接收到的字节数 txbyt/s:每秒钟发送出去的字节数
rxcmp/s:每秒钟接收到的压缩包数目 txcmp/s:每秒钟发送出去的压缩包数目
txmcst/s:每秒钟发送出去的多播包的包数目
rxmcst/s:每秒钟接收到的多播包的包数目
查看网卡txqueuelen和mtu
sujing@sujing-GW-001N1B-FTF:~$ ifconfig enaftgm1i0
enaftgm1i0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 172.30.110.20 netmask 255.255.255.0 broadcast 172.30.110.255inet6 fe80::54fe:45f6:974e:8db3 prefixlen 64 scopeid 0x20<link>ether 00:07:3e:9d:55:8f txqueuelen 1000 (以太网)RX packets 652608 bytes 642584273 (642.5 MB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 296008 bytes 68018190 (68.0 MB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0device interrupt 7 base 0xa000 sujing@sujing-GW-001N1B-FTF:~$
抓包tcpdump
tcpdump -i 网口名 -vnn icmp and host 172.30.110.20 -w ena.pcap
tcpdump -r ena.pcap -vnn icmp
tcpdump -r ena.pcap > ena.txt
抓包参数-venn会显示mac地址,常用于arp异常需要对比mac的场景
网络数据收发状态
snmp协议栈
可以测试前后查询snmp统计信息,对比协议数据差异
sujing@sujing-GW-001N1B-FTF:~$ cat /proc/net/snmp
Ip: Forwarding DefaultTTL InReceives InHdrErrors InAddrErrors ForwDatagrams InUnknownProtos InDiscards InDelivers OutRequests OutDiscards OutNoRoutes ReasmTimeout ReasmReqds ReasmOKs ReasmFails FragOKs FragFails FragCreates
Ip: 2 64 441521 0 0 0 0 0 440776 271837 32 1138 0 0 0 0 0 0 0
Icmp: InMsgs InErrors InCsumErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps
Icmp: 15150 135 0 10061 0 0 0 0 12 5077 0 0 0 0 19036 0 8302 0 0 0 0 10722 12 0 0 0 0
IcmpMsg: InType0 InType3 InType8 OutType0 OutType3 OutType8
IcmpMsg: 5077 10061 12 12 8302 10722
Tcp: RtoAlgorithm RtoMin RtoMax MaxConn ActiveOpens PassiveOpens AttemptFails EstabResets CurrEstab InSegs OutSegs RetransSegs InErrs OutRsts InCsumErrors
Tcp: 1 200 120000 -1 3901 1405 138 93 12 417844 263794 951 0 1009 0
Udp: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
Udp: 8189 754 0 16837 0 0 0 137
UdpLite: InDatagrams NoPorts InErrors OutDatagrams RcvbufErrors SndbufErrors InCsumErrors IgnoredMulti
UdpLite: 0 0 0 0 0 0 0 0
sujing@sujing-GW-001N1B-FTF:~$
netstat -i所有网口TX-OK、RX-OK
netstat -i 查看所有网口的收发数据
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
enaftgm1 1500 617109 0 0 0 266446 0 0 0 BMRU
lo 65536 29728 0 0 0 29728 0 0 0 LRU
wlp6s0 1500 0 0 0 0 0 0 0 0 BMU
sujing@sujing-GW-001N1B-FTF:~$
netstat-s查看各个协议的收发数据
Ip:Forwarding: 21722338 total packets received54 with invalid addresses0 forwarded0 incoming packets discarded1719825 incoming packets delivered1265231 requests sent out32 outgoing packets dropped2753 dropped because of missing route
Icmp:64774 ICMP messages received135 input ICMP message failedICMP接收历史destination unreachable: 44837echo requests: 21echo replies: 1991686519 ICMP messages sent0 ICMP messages failedICMP发出历史destination unreachable: 32472echo requests: 54026echo replies: 21
IcmpMsg:InType0: 19916InType3: 44837InType8: 21OutType0: 21OutType3: 32472OutType8: 54026
Tcp:33246 active connection openings8395 passive connection openings169 failed connection attempts5316 connection resets received12 connections established1595897 segments received4007792 segments sent out7807 segments retransmitted0 bad segments received3585 resets sent
Udp:62064 packets received764 packets to unknown port received0 packet receive errors101660 packets sent0 receive buffer errors0 send buffer errorsIgnoredMulti: 825
UdpLite:
TcpExt:3 ICMP packets dropped because they were out-of-window10816 TCP sockets finished time wait in fast timer10745 delayed acks sent16 delayed acks further delayed because of locked socketQuick ack mode was activated 762 times687537 packet headers predicted327418 acknowledgments not containing data payload received400369 predicted acknowledgmentsTCPSackRecovery: 2Detected reordering 34 times using SACKTCPDSACKUndo: 1TCPLostRetransmit: 29082 fast retransmits3 retransmits in slow startTCPTimeouts: 4269TCPLossProbes: 4098TCPLossProbeRecovery: 4TCPBacklogCoalesce: 10836TCPDSACKOldSent: 762TCPDSACKOfoSent: 1TCPDSACKRecv: 122288 connections reset due to unexpected data494 connections reset due to early user close398 connections aborted due to timeout2 times unable to send RST due to no memoryTCPDSACKIgnoredNoUndo: 93TCPSackShiftFallback: 52IPReversePathFilter: 51TCPRcvCoalesce: 212062TCPOFOQueue: 5598TCPOFOMerge: 1TCPChallengeACK: 4TCPFastOpenActiveFail: 1TCPFastOpenBlackhole: 1TCPSpuriousRtxHostQueues: 142TCPAutoCorking: 2412TCPFromZeroWindowAdv: 13TCPToZeroWindowAdv: 13TCPWantZeroWindowAdv: 233TCPSynRetrans: 1114TCPOrigDataSent: 3463644TCPHystartTrainDetect: 112TCPHystartTrainCwnd: 4232TCPHystartDelayDetect: 17TCPHystartDelayCwnd: 498TCPACKSkippedSeq: 78TCPWinProbe: 10TCPKeepAlive: 11076TCPDelivered: 3478201TCPAckCompressed: 219TCPZeroWindowDrop: 1
IpExt:OutMcastPkts: 2InBcastPkts: 5329OutBcastPkts: 793InOctets: 1487954612OutOctets: 4610532528OutMcastOctets: 80InBcastOctets: 614719OutBcastOctets: 118975InNoECTPkts: 2138886
sujing@sujing-GW-001N1B-FTF:~$
ethtool -S单个网口的收发包详细数据
ethtool -S 网口名
sujing@sujing-GW-001N1B-FTF:~$ ethtool -S enaftgm1i0
NIC statistics:mmc_tx_octetcount_gb: 58868192mmc_tx_framecount_gb: 250120mmc_tx_broadcastframe_g: 14244mmc_tx_multicastframe_g: 37mmc_tx_64_octets_gb: 186804mmc_tx_65_to_127_octets_gb: 19121mmc_tx_128_to_255_octets_gb: 3242mmc_tx_256_to_511_octets_gb: 5059mmc_tx_512_to_1023_octets_gb: 4130mmc_tx_1024_to_max_octets_gb: 31764mmc_tx_unicast_gb: 235839mmc_tx_multicast_gb: 37mmc_tx_broadcast_gb: 14244mmc_tx_underflow_error: 0mmc_tx_singlecol_g: 0mmc_tx_multicol_g: 0mmc_tx_deferred: 0mmc_tx_latecol: 0mmc_tx_exesscol: 0mmc_tx_carrier_error: 0mmc_tx_octetcount_g: 58868192mmc_tx_framecount_g: 250120mmc_tx_excessdef: 0mmc_tx_pause_frame: 0mmc_tx_vlan_frame_g: 0mmc_rx_framecount_gb: 596919mmc_rx_octetcount_gb: 623609801mmc_rx_octetcount_g: 623609801mmc_rx_broadcastframe_g: 5159mmc_rx_multicastframe_g: 615mmc_rx_crc_error: 0mmc_rx_align_error: 0mmc_rx_run_error: 0mmc_rx_jabber_error: 0mmc_rx_undersize_g: 0mmc_rx_oversize_g: 0mmc_rx_64_octets_gb: 81840mmc_rx_65_to_127_octets_gb: 14988mmc_rx_128_to_255_octets_gb: 4523mmc_rx_256_to_511_octets_gb: 6889mmc_rx_512_to_1023_octets_gb: 2814mmc_rx_1024_to_max_octets_gb: 485865mmc_rx_unicast_g: 591145mmc_rx_length_error: 0mmc_rx_autofrangetype: 0mmc_rx_pause_frames: 0mmc_rx_fifo_overflow: 0mmc_rx_vlan_frames_gb: 0mmc_rx_watchdog_error: 0mmc_rx_ipc_intr_mask: 1073692671mmc_rx_ipc_intr: 0mmc_rx_ipv4_gd: 591676mmc_rx_ipv4_hderr: 0mmc_rx_ipv4_nopay: 5mmc_rx_ipv4_frag: 0mmc_rx_ipv4_udsbl: 0mmc_rx_ipv4_gd_octets: 612160193mmc_rx_ipv4_hderr_octets: 0mmc_rx_ipv4_nopay_octets: 230mmc_rx_ipv4_frag_octets: 0mmc_rx_ipv4_udsbl_octets: 0mmc_rx_ipv6_gd_octets: 2966mmc_rx_ipv6_hderr_octets: 0mmc_rx_ipv6_nopay_octets: 0mmc_rx_ipv6_gd: 37mmc_rx_ipv6_hderr: 0mmc_rx_ipv6_nopay: 0mmc_rx_udp_gd: 5731mmc_rx_udp_err: 0mmc_rx_tcp_gd: 580159mmc_rx_tcp_err: 0mmc_rx_icmp_gd: 5823mmc_rx_icmp_err: 0mmc_rx_udp_gd_octets: 493687mmc_rx_udp_err_octets: 0mmc_rx_tcp_gd_octets: 599431760mmc_rx_tcp_err_octets: 0mmc_rx_icmp_gd_octets: 402672mmc_rx_icmp_err_octets: 0mmc_tx_fpe_fragment_cntr: 0mmc_tx_hold_req_cntr: 0mmc_rx_packet_assembly_err_cntr: 0mmc_rx_packet_smd_err_cntr: 0mmc_rx_packet_assembly_ok_cntr: 0mmc_rx_fpe_fragment_cntr: 0tx_underflow: 0tx_carrier: 0tx_losscarrier: 0vlan_tag: 0tx_deferred: 0tx_vlan: 0tx_jabber: 0tx_frame_flushed: 0tx_payload_error: 0tx_ip_header_error: 0rx_desc: 0sa_filter_fail: 0overflow_error: 0ipc_csum_error: 0rx_collision: 0rx_crc_errors: 0dribbling_bit: 0rx_length: 0rx_mii: 0rx_multicast: 0rx_gmac_overflow: 0rx_watchdog: 0da_rx_filter_fail: 0sa_rx_filter_fail: 0rx_missed_cntr: 0rx_overflow_cntr: 0rx_vlan: 0rx_split_hdr_pkt_n: 0tx_undeflow_irq: 0tx_process_stopped_irq: 0tx_jabber_irq: 0rx_overflow_irq: 0rx_buf_unav_irq: 0rx_process_stopped_irq: 0rx_watchdog_irq: 0tx_early_irq: 0fatal_bus_error_irq: 0rx_early_irq: 12934threshold: 1tx_pkt_n: 250120rx_pkt_n: 596919normal_irq_n: 637754rx_normal_irq_n: 406290napi_poll: 1079256tx_normal_irq_n: 241900tx_clean: 672944tx_set_ic_bit: 250120irq_receive_pmt_irq_n: 0mmc_tx_irq_n: 0mmc_rx_irq_n: 0mmc_rx_csum_offload_irq_n: 0irq_tx_path_in_lpi_mode_n: 0irq_tx_path_exit_lpi_mode_n: 0irq_rx_path_in_lpi_mode_n: 0irq_rx_path_exit_lpi_mode_n: 0phy_eee_wakeup_error_n: 0ip_hdr_err: 0ip_payload_err: 0ip_csum_bypassed: 0ipv4_pkt_rcvd: 0ipv6_pkt_rcvd: 0no_ptp_rx_msg_type_ext: 0ptp_rx_msg_type_sync: 0ptp_rx_msg_type_follow_up: 0ptp_rx_msg_type_delay_req: 0ptp_rx_msg_type_delay_resp: 0ptp_rx_msg_type_pdelay_req: 0ptp_rx_msg_type_pdelay_resp: 0ptp_rx_msg_type_pdelay_follow_up: 0ptp_rx_msg_type_announce: 0ptp_rx_msg_type_management: 0ptp_rx_msg_pkt_reserved_type: 0ptp_frame_type: 0ptp_ver: 0timestamp_dropped: 0av_pkt_rcvd: 0av_tagged_pkt_rcvd: 0vlan_tag_priority_val: 0l3_filter_match: 0l4_filter_match: 0l3_l4_filter_no_match: 0irq_pcs_ane_n: 0irq_pcs_link_n: 0irq_rgmii_n: 0mtl_tx_status_fifo_full: 0mtl_tx_fifo_not_empty: 0mmtl_fifo_ctrl: 0mtl_tx_fifo_read_ctrl_write: 0mtl_tx_fifo_read_ctrl_wait: 0mtl_tx_fifo_read_ctrl_read: 0mtl_tx_fifo_read_ctrl_idle: 0mac_tx_in_pause: 0mac_tx_frame_ctrl_xfer: 0mac_tx_frame_ctrl_idle: 0mac_tx_frame_ctrl_wait: 0mac_tx_frame_ctrl_pause: 0mac_gmii_tx_proto_engine: 0mtl_rx_fifo_fill_level_full: 0mtl_rx_fifo_fill_above_thresh: 0mtl_rx_fifo_fill_below_thresh: 0mtl_rx_fifo_fill_level_empty: 0mtl_rx_fifo_read_ctrl_flush: 0mtl_rx_fifo_read_ctrl_read_data: 0mtl_rx_fifo_read_ctrl_status: 0mtl_rx_fifo_read_ctrl_idle: 0mtl_rx_fifo_ctrl_active: 0mac_rx_frame_ctrl_fifo: 0mac_gmii_rx_proto_engine: 0tx_tso_frames: 0tx_tso_nfrags: 0
sujing@sujing-GW-001N1B-FTF:~$
ethtool查看网卡配置
ethtool -K设置流控属性
ethtool -K eth0 gro off
ethtool -K eth0 gso off
ethtool -L设置多队列
万兆网卡多队列
ethtool -l enaftigm
ethtool -L eth0 combined 4
ethtool -G查看ringbuffer
ethtool -g|–show-ring DEVNAME Query RX/TX ring parameters
ethtool -G|–set-ring DEVNAME Set RX/TX ring parameters
ethtool -i enaftgm1i0 查看驱动版本
sujing@sujing-GW-001N1B-FTF:~$ ethtool -i enaftgm1i0
driver: st_gmac
version: Jan_2016
firmware-version:
expansion-rom-version:
bus-info:
supports-statistics: yes
supports-test: no
supports-eeprom-access: yes
supports-register-dump: yes
supports-priv-flags: no
sujing@sujing-GW-001N1B-FTF:~$
网络查表
arp
arp -n查看arp表
sudo arp -d 172.30.110.254删除表项
sudo arp -s 172.30.110.254 3c:c7:86:39:59:e6 -i enaftgm1i0添加表项
也可以ip neigh show
ip neigh add 10.3.3.1 laddr 网口mac地址 dev 网口名
ip neigh del 10.3.3.1 dev 网口名
路由表
route -n查看
sudo ip route del 172.30.200.0/24删除路由
sudo ip route add 172.30.200.0/24 via 172.30.110.254 dev enaftgm1i0添加路由
也可以route add -net 10.3.3.0/24 gw 10.3.3.1 dev enaftgm1i0
conntrack表
查看表、新增、删除
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -I -p udp -s 172.30.200.180 -d 172.30.110.20 --dport 7000 --sport 6000 --timeout 50
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been created.
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -D
udp 17 44 src=172.30.200.180 dst=172.30.110.20 sport=6000 dport=7000 [UNREPLIED] src=172.30.110.20 dst=172.30.200.180 sport=7000 dport=6000 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been deleted.
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -I -p udp -s 172.30.200.180 -d 172.30.110.20 --dport 7000 --sport 6000 --timeout 50
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been created.
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -L
udp 17 47 src=172.30.200.180 dst=172.30.110.20 sport=6000 dport=7000 [UNREPLIED] src=172.30.110.20 dst=172.30.200.180 sport=7000 dport=6000 mark=0 use=1
conntrack v1.4.5 (conntrack-tools): 1 flow entries have been shown.
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -F
conntrack v1.4.5 (conntrack-tools): connection tracking table has been emptied.
sujing@sujing-GW-001N1B-FTF:~$ sudo conntrack -L
conntrack v1.4.5 (conntrack-tools): 0 flow entries have been shown.
sujing@sujing-GW-001N1B-FTF:~$
5.软件包
dpkg查找可执行文件所在软件包名
sujing@sujing-GW-001N1B-FTF:~$ which smbd
/usr/sbin/smbd
sujing@sujing-GW-001N1B-FTF:~$ dpkg --search /usr/sbin/smbd
dpkg-query: 警告: 正在解析文件 '/var/lib/dpkg/status' 第 58041 行附近,软件包 'usb-match-hidraw-rules' :missing 'Description' field
samba: /usr/sbin/smbd
sujing@sujing-GW-001N1B-FTF:~$ dpkg --status samba
rpm查找可执行文件所在软件包名
[root@localhost ~]# rpm -qf /usr/include/iptables
iptables-devel-1.8.4-5.ky10.aarch64
[root@localhost ~]#
解压rpm包指令
rpm2cpio cronie-anacron-1.4.12-1.nd7.9.mips64el.rpm | cpio -idmv./etc/anacrontab
./etc/cron.hourly/0anacron
./etc/cron.hourly/adjtime
./etc/cron.hourly/jobs.deny
./usr/sbin/anacron
./usr/share/man/man5/anacrontab.5.gz
./usr/share/man/man8/anacron.8.gz
./var/spool/anacron
95 块
查询某个可执行文件所在目录
[root@localhost ~]# whereis iptables
iptables: /usr/sbin/iptables /usr/include/iptables /usr/include/iptables.h /usr/libexec/iptables
6.DNS相关
DNS域名解析服务–Named服务
DNS服务对应的软件包名是bind,实际的后台服务是named
yum list | grep bind # 查询一下bind的包
# 输出 ---------------------------
bind.x86_64 # 主包 named DNS服务named-chkconfig(named.conf文件检查工具)named-checkzone(zone文件检车工具)rndc(本地和远程dns控制工具)
bind-chroot.x86_64 # 切换默认目录到另外一个深层的安全的目录
bind-libs.x86_64 # named DNS服务的库
bind-utils.x86_64 # 包含一系列辅助工具来测试hostdignslookupnsupdate
-------------------------------
yum install bind* -y
-----------------------------
配置文件:
/etc/named.conf
/etc/name.rfc1912.zones
/var/named/yyh.com.zone
服务状态:
systemctl status named
dns解析过程
https://blog.csdn.net/bangshao1989/article/details/121913780
dig域名查询工具
dig(域信息搜索器)执行DNS搜索,显示从接受请求的域名服务器返回的答复。
sujing@sujing-GW-001N1B-FTF:~$ dig baidu.com; <<>> DiG 9.16.1-Ubuntu <<>> baidu.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42307
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;baidu.com. IN A;; ANSWER SECTION:
baidu.com. 138 IN A 110.242.68.66
baidu.com. 138 IN A 39.156.66.10;; Query time: 88 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: 四 1月 25 16:31:37 CST 2024
;; MSG SIZE rcvd: 70sujing@sujing-GW-001N1B-FTF:~$
//里面的ANSWER SECTION中的138代表dns转发服务器缓存过期时间
nslookup域名查询工具
查看某个地址的DNS解析信息
sujing@sujing-GW-001N1B-FTF:~$ nslookup baidu.com
Server: 8.8.8.8
Address: 8.8.8.8#53Non-authoritative answer:
Name: baidu.com
Address: 39.156.66.10
Name: baidu.com
Address: 110.242.68.66sujing@sujing-GW-001N1B-FTF:~$
tcpdump抓取dns数据包
tcpdump -i any -nv port domain
port domain表示只抓取使用domain(域名)服务的数据包
7.CPU相关
绑核taskset与核隔离
taskset -c 0-10 stress -c 8
cmdline里加上:isolcpus=2,3
isolcpus 隔离核操作将指定的CPU核从调度器中剥离出来,因此失去了cpu间的任务调度和负载均衡等功能。在隔离核之前cpu
调度器会将任务调度到不同的核上,隔离核之后失去该功能,而taskset提供的是一个cpu核范围,实际使用的是cpu号较小的核。