zoukankan      html  css  js  c++  java
  • 命令拷屏之网络工具

    有线与无线网络配置相关工具

    network与NetworkManager

    initscripts包

    net-tools包 net-tools-1.60-110.el6_2.x86_64,已经逐渐被iproute替换

    NetworkManager包

    iproute包

    ethtool-4.8-1.el7.x86_64包

    [root@kvm1 network-scripts]# rpm -qa |grep NetworkManager
    NetworkManager-bluetooth-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-libnm-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-tui-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-glib-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-team-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-wifi-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-wwan-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-adsl-1.0.0-14.git20150121.b4ea599c.el7.x86_64
    NetworkManager-libreswan-0.9.8.0-5.el7.x86_64
    [root@kvm1 network-scripts]# NetworkManager-tui
    bash: NetworkManager-tui: command not found...
    [root@kvm1 network-scripts]# rpm -ql NetworkManager-tui
    /usr/bin/nmtui
    /usr/bin/nmtui-connect
    /usr/bin/nmtui-edit
    /usr/bin/nmtui-hostname
    /usr/share/man/man1/nmtui-connect.1.gz
    /usr/share/man/man1/nmtui-edit.1.gz
    /usr/share/man/man1/nmtui-hostname.1.gz
    /usr/share/man/man1/nmtui.1.gz

    [root@kvm1 network-scripts]# rpm -ql initscripts|more

     https://wiki.archlinux.org/index.php/Wireless_network_configuration_%28%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%29#.E5.85.B3.E8.81.94

    以下是无线网络配置

    yum install iw
    yum install util-linux    lscpu
    yum install usbutils    lsusb
    yum install pciutils    lspci


    [root@localhost network-scripts]# dmesg |grep usbcore
    [    0.122031] usbcore: registered new interface driver usbfs
    [    0.122034] usbcore: registered new interface driver hub
    [    0.122047] usbcore: registered new device driver usb
    [    0.411834] usbcore: registered new interface driver usbserial
    [    0.411837] usbcore: registered new interface driver usbserial_generic
    [    0.413292] usbcore: registered new interface driver usbhid
    [    6.089705] usbcore: registered new interface driver rtl8192cu
    [root@localhost network-scripts]# dmesg |grep firmware
    [    5.733830] rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
    [root@localhost network-scripts]# lsusb
    Bus 001 Device 002: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
    [root@localhost network-scripts]# lspci
    00:19.0 Ethernet controller: Intel Corporation Ethernet Connection I217-V


    ip link
    ip link set wlp0s20u1 up     
    iw phy|list  二者是一样的
    [root@localhost ~]# iw dev
    phy#0
            Interface wlp0s20u1
                    ifindex 3
                    wdev 0x1
                    addr ec:17:2f:ce:48:71
                    type managed
    [root@localhost ~]# iw reg get
    country 00: DFS-UNSET
            (2402 - 2472 @ 40), (6, 20)
            (2457 - 2482 @ 40), (6, 20), PASSIVE-SCAN
            (2474 - 2494 @ 20), (6, 20), NO-OFDM, PASSIVE-SCAN
            (5170 - 5250 @ 160), (6, 20), PASSIVE-SCAN
            (5250 - 5330 @ 160), (6, 20), DFS, PASSIVE-SCAN
            (5490 - 5730 @ 160), (6, 20), DFS, PASSIVE-SCAN
            (5735 - 5835 @ 80), (6, 20), PASSIVE-SCAN
            (57240 - 63720 @ 2160), (N/A, 0)
    iw wlp0s20u1 scan        扫描可用热点
    iw wlp0s20u1 link         获取连接状态
    iw wlp0s20u1 set type managed
    iw wlp0s20u1 connect -w wo

    wpa_supplicant -B -i wlp0s20u1 -c <(wpa_passphrase "wo" "3g8888")

    wpa_supplicant -B -i wlp0s20u1 -c /etc/wpa_supplicant/wpa_supplicant.conf


    [root@localhost ~]# nmcli device wifi list
    *  SSID              MODE   CHAN  RATE       SIGNAL  BARS  SECURITY
       TP-LINK_wang      Infra  6     54 Mbit/s  87      ▂▄▆█  WPA1 WPA2
       ................  Infra  1     54 Mbit/s  74      ▂▄▆_  WPA1 WPA2
       dt                Infra  1     54 Mbit/s  57      ▂▄▆_  WPA1 WPA2
       ChinaNet-RQde     Infra  3     54 Mbit/s  47      ▂▄__  WPA1
       FAST_1BCE         Infra  11    54 Mbit/s  44      ▂▄__  WPA1 WPA2
       MERCURY_B2B2B8    Infra  6     48 Mbit/s  47      ▂▄__  WPA1 WPA2
       TP-LINK_22C6      Infra  11    54 Mbit/s  60      ▂▄▆_  WPA1 WPA2
       TP-LINK_A5DA9E    Infra  1     54 Mbit/s  57      ▂▄▆_  WPA1 WPA2
       Tenda_25B898      Infra  8     54 Mbit/s  44      ▂▄__  WPA1
       TP-LINK_0D82      Infra  1     54 Mbit/s  57      ▂▄▆_  WPA1 WPA2
       wo                Infra  6     54 Mbit/s  67      ▂▄▆_  WPA2
    [root@localhost ~]# nmcli --ask device connect wlp0s20u1
    [root@localhost ~]# nmcli device  wifi connect "wo" password "3g88888" ifname wlp0s20u1

    [root@localhost network-scripts]# nmcli --ask device wifi connect wo
    Device 'wlp0s20u1' successfully activated with '348382ff-dd55-4a7d-b997-e3e4530dee3b'.
    [root@localhost network-scripts]# ip addr
    1: 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
           valid_lft forever preferred_lft forever
    2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
        link/ether 74:d4:35:f3:12:83 brd ff:ff:ff:ff:ff:ff
        inet 192.168.10.116/24 brd 192.168.10.255 scope global dynamic eno1
           valid_lft 4439sec preferred_lft 4439sec
    3: wlp0s20u1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
        link/ether ec:17:2f:ce:48:71 brd ff:ff:ff:ff:ff:ff
        inet 192.168.10.111/24 brd 192.168.10.255 scope global dynamic wlp0s20u1
           valid_lft 7194sec preferred_lft 7194sec
    
    [root@localhost network-scripts]# ip link set eno1 down
    
    [root@localhost ~]# iw wlp0s20u1 link
    Connected to f8:d1:11:fd:1a:d8 (on wlp0s20u1)
            SSID: wo
            freq: 2437
            RX: 4823458 bytes (10181 packets)
            TX: 270599 bytes (3469 packets)
            signal: -51 dBm
            tx bitrate: 54.0 MBit/s
    
            bss flags:      short-preamble short-slot-time
            dtim period:    1
            beacon int:     100
    根据日志确定是无线路由器的密钥AES,客户端不支持
    [root@localhost wpa_supplicant]# tail -f /var/log/wpa_supplicant.log
    
    wlp0s20u1: CTRL-EVENT-DISCONNECTED bssid=f8:d1:11:fd:1a:d8 reason=3 locally_generated=1
    wlp0s20u1: Failed to initiate AP scan
    wlp0s20u1: SME: Trying to authenticate with f8:d1:11:fd:1a:d8 (SSID='wo' freq=2437 MHz)
    wlp0s20u1: SME: Authentication request to the driver failed
    wlp0s20u1: Associated with f8:d1:11:fd:1a:d8
    wlp0s20u1: WPA: Invalid EAPOL-Key MIC when using TPTK - ignoring TPTK
    wlp0s20u1: WPA: Could not verify EAPOL-Key MIC - dropping packet
    wlp0s20u1: Authentication with f8:d1:11:fd:1a:d8 timed out.
    wlp0s20u1: CTRL-EVENT-DISCONNECTED bssid=f8:d1:11:fd:1a:d8 reason=3 locally_generated=1
    wlp0s20u1: WPA: 4-Way Handshake failed - pre-shared key may be incorrect
    wlp0s20u1: CTRL-EVENT-SSID-TEMP-DISABLED id=0 ssid="wo" auth_failures=1 duration=10
    wlp0s20u1: No network configuration found for the current AP
    
    		
    wlp0s20u1: CTRL-EVENT-DISCONNECTED bssid=f8:d1:11:fd:1a:d8 reason=3 locally_generated=1
    wlp0s20u1: Associated with f8:d1:11:fd:1a:d8
    wlp0s20u1: WPA: CCMP is used, but EAPOL-Key descriptor version (1) is not 2
    wlp0s20u1: WPA: CCMP is used, but EAPOL-Key descriptor version (1) is not 2
    wlp0s20u1: Authentication with f8:d1:11:fd:1a:d8 timed out.
    wlp0s20u1: CTRL-EVENT-DISCONNECTED bssid=f8:d1:11:fd:1a:d8 reason=3 locally_generated=1
    wlp0s20u1: Failed to initiate AP scan
    wlp0s20u1: Associated with f8:d1:11:fd:1a:d8
    wlp0s20u1: CTRL-EVENT-CONNECTED - Connection to f8:d1:11:fd:1a:d8 completed [id=0 id_str=]

    在路由器上将原来的AES改为TKIP就可以了

    下面或许会有用

    [root@localhost ~]# vi /etc/wpa_supplicant/wpa_supplicant.conf

    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=0
    eapol_version=1
    #ap_scan=0
    #fast_reauth=1
    network={
    ssid="Jay"
    key_mgmt=WPA-PSK
    proto=WPA
    pairwise=TKIP
    group=TKIP
    psk="MyKeyGoesHere"
    }

    ctrl_interface=/var/run/wpa_supplicant
    ap_scan=2

    network={
    ssid="yours here"
    scan_ssid=1
    proto=RSN
    key_mgmt=WPA-PSK
    group=TKIP
    pairwise=TKIP
    psk="yours here"
    }

    ethtool - query or control network driver and hardware settings
    
    [root@ka1che225 ~]# ethtool -g enp3s0
    Ring parameters for enp3s0:
    Cannot get device ring settings: Operation not supported
    
    [root@ka1che225 ~]# ethtool -i enp3s0
    driver: r8169
    version: 2.3LK-NAPI
    firmware-version: rtl8168g-2_0.0.1 02/06/13
    expansion-rom-version:
    bus-info: 0000:03:00.0
    supports-statistics: yes
    supports-test: no
    supports-eeprom-access: no
    supports-register-dump: yes
    supports-priv-flags: no
    
    
    [root@ka1che225 ~]# ethtool -K enp3s0 tso off
    
    https://www.cnblogs.com/lvyilong316/p/6818231.html
    linux tcp GSO和TSO实现
    
    [root@ka1che225 ~]# ethtool --show-features enp3s0
    Features for enp3s0:
    rx-checksumming: on
    tx-checksumming: off
            tx-checksum-ipv4: off
            tx-checksum-ip-generic: off [fixed]
            tx-checksum-ipv6: off
            tx-checksum-fcoe-crc: off [fixed]
            tx-checksum-sctp: off [fixed]
    scatter-gather: off
            tx-scatter-gather: off
            tx-scatter-gather-fraglist: off [fixed]
    tcp-segmentation-offload: off
            tx-tcp-segmentation: off
            tx-tcp-ecn-segmentation: off [fixed]
            tx-tcp6-segmentation: off
            tx-tcp-mangleid-segmentation: off
    udp-fragmentation-offload: off [fixed]
    generic-segmentation-offload: off [requested on]
    generic-receive-offload: on
    large-receive-offload: off [fixed]
    rx-vlan-offload: on
    tx-vlan-offload: on
    ntuple-filters: off [fixed]
    receive-hashing: off [fixed]
    highdma: on [fixed]
    rx-vlan-filter: off [fixed]
    vlan-challenged: off [fixed]
    tx-lockless: off [fixed]
    netns-local: off [fixed]
    tx-gso-robust: off [fixed]
    tx-fcoe-segmentation: off [fixed]
    tx-gre-segmentation: off [fixed]
    tx-ipip-segmentation: off [fixed]
    tx-sit-segmentation: off [fixed]
    tx-udp_tnl-segmentation: off [fixed]
    tx-mpls-segmentation: off [fixed]
    fcoe-mtu: off [fixed]
    tx-nocache-copy: off
    loopback: off [fixed]
    rx-fcs: off
    rx-all: off
    tx-vlan-stag-hw-insert: off [fixed]
    rx-vlan-stag-hw-parse: off [fixed]
    rx-vlan-stag-filter: off [fixed]
    busy-poll: off [fixed]
    tx-gre-csum-segmentation: off [fixed]
    tx-udp_tnl-csum-segmentation: off [fixed]
    tx-gso-partial: off [fixed]
    tx-sctp-segmentation: off [fixed]
    l2-fwd-offload: off [fixed]
    hw-tc-offload: off [fixed]
    
    [root@ka1che225 ~]# ethtool -P enp3s0
    Permanent address: 9c:5c:8e:71:69:06
    [root@ka1che225 ~]# ethtool -S enp3s0
    NIC statistics:
         tx_packets: 22796988
         rx_packets: 93239180
         tx_errors: 0
         rx_errors: 0
         rx_missed: 0
         align_errors: 0
         tx_single_collisions: 0
         tx_multi_collisions: 0
         unicast: 21604090
         broadcast: 24823507
         multicast: 46811583
         tx_aborted: 0
         tx_underrun: 0
    
    [root@ka1che225 ~]# ethtool -T enp3s0
    Time stamping parameters for enp3s0:
    Capabilities:
            software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
            software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
            software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
    PTP Hardware Clock: none
    Hardware Transmit Timestamp Modes: none
    Hardware Receive Filter Modes: none	 
    	 
    [root@ka1che225 ~]# ethtool --phy-statistics enp3s0
    no stats available
    [root@ka1che225 ~]# ethtool -w enp3s0
    Can not get dump level
    : Operation not supported
    [root@ka1che225 ~]# ethtool -l enp3s0
    Channel parameters for enp3s0:
    Cannot get device channel parameters
    : Operation not supported
    [root@ka1che225 ~]# ethtool --module-info enp3s0
    Cannot get module EEPROM information: Operation not supported
    ethtool -k|--show-features|--show-offload DEVNAME       Get state of protocol offload and other features
    ethtool -k enp3s0
    
    
    tcp-segmentation-offload: off
            tx-tcp-segmentation: off
            tx-tcp-ecn-segmentation: off [fixed]
            tx-tcp6-segmentation: off
            tx-tcp-mangleid-segmentation: off
    udp-fragmentation-offload: off [fixed]
    generic-segmentation-offload: off [requested on]
    generic-receive-offload: on
    large-receive-offload: off [fixed]
    
    tso
    ufo
    gso
    
    gro
    lro
    
    
    这些offload特性都是为了提升网络收/发性能。TSO、UFO和GSO是对应网络发送,在接收方向上对应的是LRO、GRO。
    
    TSO
    
    TSO(TCP Segmentation Offload),是一种利用网卡对TCP数据包分片,减轻CPU负荷的一种技术,有时也被叫做 LSO (Large segment offload) ,TSO是针对TCP的,UFO是针对UDP的。如果硬件支持 TSO功能,同时也需要硬件支持的TCP校验计算和分散/聚集 (Scatter Gather) 功能。
    
    GSO
    
    GSO(Generic Segmentation Offload),它比TSO更通用,基本思想就是尽可能的推迟数据分片直至发送到网卡驱动之前,此时会检查网卡是否支持分片功能(如TSO、UFO),如果支持直接发送到网卡,如果不支持就进行分片后再发往网卡。这样大数据包只需走一次协议栈,而不是被分割成几个数据包分别走,这就提高了效率。
    
    LRO
    
    LRO(Large Receive Offload),通过将接收到的多个TCP数据聚合成一个大的数据包,然后传递给网络协议栈处理,以减少上层协议栈处理 开销,提高系统接收TCP数据包的能力。
    
    GRO
    
    GRO(Generic Receive Offload),基本思想跟LRO类似,克服了LRO的一些缺点,更通用。后续的驱动都使用GRO的接口,而不是LRO。
    
    RSS
    
    RSS(Receive Side Scaling),是一项网卡的新特性,俗称多队列。具备多个RSS队列的网卡,可以将不同的网络流分成不同的队列,再分别将这些队列分配到多个CPU核心上进行处理,从而将负荷分散,充分利用多核处理器的能力。
    
    可以使用如下命令来关闭对应的参数:
    
    /usr/sbin/ethtool -K eth1 gro off
    /usr/sbin/ethtool -K eth1 lro off
    /usr/sbin/ethtool -K eth1 tso off
  • 相关阅读:
    xtrabackup之Innobackupex全备数据库
    没有Where条件下group by走索引
    Oracle中查看无效的对象、约束、触发器和索引
    udev/raw/asmlib/多路径 配置asm
    自适应游标共享技术02(一个简单的例子来走近ACS)
    自适应游标共享技术03(常用分析脚本)
    监控进程是否存在
    MySQL运行状态show status详解
    MySQL 加锁处理分析
    使用RMAN验证备份的有效性
  • 原文地址:https://www.cnblogs.com/createyuan/p/5440593.html
Copyright © 2011-2022 走看看