Linux Network Client Tools

ping command

send ICMP echo request to the target host agreement

Common options:

  • From the specified native interface to send ICMP: -I INTERFACE

    This machine has a plurality of interfaces (NIC), which interface can be selected from hair: -I (uppercase i)

    Enp0s3 local network is an interface ip; enp0s8 interfaces is nat ip address, enp0s8 can access the network, enp0s3 not. Here are ping verification.

    # ifconfig enp0s3
    enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.56.107  netmask 255.255.255.0  broadcast 192.168.56.255
    # ifconfig enp0s8
    enp0s8: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 10.0.3.15  netmask 255.255.255.0  broadcast 10.0.3.255
    
    # ping -I enp0s8 tuna.tsinghua.edu.cn
    PING tuna.tsinghua.edu.cn (101.6.6.172) from 10.0.3.15 enp0s8: 56(84) bytes of data.
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=1 ttl=45 time=68.3 ms
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=2 ttl=45 time=79.2 ms
    ^C
    --- tuna.tsinghua.edu.cn ping statistics ---
    2 packets transmitted, 2 received, 0% packet loss, time 1005ms
    rtt min/avg/max/mdev = 68.379/73.811/79.244/5.439 ms
    # ping -I enp0s3 tuna.tsinghua.edu.cn
    PING tuna.tsinghua.edu.cn (101.6.6.172) from 192.168.56.107 enp0s3: 56(84) bytes of data.
    
  • The number of designated transmission packet: -c #

  • Specify the size of the package: -s #

    # ping -s 9999 www.baidu.com
    PING www.a.shifen.com (61.135.169.121) 9999(10027) bytes of data.
  • Ping specified length of time to run: -w

  • Ping the specified time, the longest wait long for a response: -W

    # ping -I enp0s8 -c 3 tuna.tsinghua.edu.cn
    PING tuna.tsinghua.edu.cn (101.6.6.172) from 10.0.3.15 enp0s8: 56(84) bytes of data.
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=1 ttl=45 time=63.0 ms
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=2 ttl=45 time=62.9 ms
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=3 ttl=45 time=60.6 ms
    
    --- tuna.tsinghua.edu.cn ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2002ms
    rtt min/avg/max/mdev = 60.663/62.218/63.037/1.100 ms
    # ping -I enp0s8 -w 2 tuna.tsinghua.edu.cn
    PING tuna.tsinghua.edu.cn (101.6.6.172) from 10.0.3.15 enp0s8: 56(84) bytes of data.
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=1 ttl=45 time=58.0 ms
    64 bytes from 101.6.6.172 (101.6.6.172): icmp_seq=2 ttl=45 time=66.1 ms
    # ping -I enp0s8 -W 2 tuna.tsinghua.edu.cn
    

hping command

Send TCP / IP packets to the target host

# yum list all | grep hping
hping3.x86_64                             0.0.20051105-24.el7          epel
pcp-pmda-shping.x86_64                    4.3.2-4.el7_7                updates
# yum install hping3
# man hping3

Common options:

  • Quick send: - fast

    # hping --fast www.baidu.com
    HPING www.baidu.com (enp0s8 61.135.169.125): NO FLAGS are set, 40 headers + 0 data bytes
    len=46 ip=61.135.169.125 ttl=255 id=12411 sport=0 flags=RA seq=0 win=0 rtt=0.2 ms
    len=46 ip=61.135.169.125 ttl=255 id=12412 sport=0 flags=RA seq=1 win=0 rtt=0.8 ms
    len=46 ip=61.135.169.125 ttl=255 id=12413 sport=0 flags=RA seq=2 win=0 rtt=0.4 ms
    len=46 ip=61.135.169.125 ttl=255 id=12414 sport=0 flags=RA seq=3 win=0 rtt=0.9 ms
    len=46 ip=61.135.169.125 ttl=255 id=12415 sport=0 flags=RA seq=4 win=0 rtt=0.7 ms
    len=46 ip=61.135.169.125 ttl=255 id=12416 sport=0 flags=RA seq=5 win=0 rtt=0.6 ms
    len=46 ip=61.135.169.125 ttl=255 id=12417 sport=0 flags=RA seq=6 win=0 rtt=0.8 ms
    len=46 ip=61.135.169.125 ttl=255 id=12418 sport=0 flags=RA seq=7 win=0 rtt=0.6 ms
    len=46 ip=61.135.169.125 ttl=255 id=12419 sport=0 flags=RA seq=8 win=0 rtt=0.7 ms
    ^C
    --- www.baidu.com hping statistic ---
    10 packets transmitted, 9 packets received, 10% packet loss
    round-trip min/avg/max = 0.2/0.6/0.9 ms

    Issued quickly, lost 10%

  • Faster send: - faster

    # hping --fast www.baidu.com
    --- www.baidu.com hping statistic ---
    21862 packets transmitted, 958 packets received, 96% packet loss
    round-trip min/avg/max = 0.1/3.9/19.9 ms

    96% of the loss

  • How fast can you send multiple: - flood

    # hping --flood www.baidu.com
    HPING www.baidu.com (enp0s8 61.135.169.125): NO FLAGS are set, 40 headers + 0 data bytes
    hping in flood mode, no replies will be shown
    ^C
    --- www.baidu.com hping statistic ---
    11883 packets transmitted, 0 packets received, 100% packet loss
    round-trip min/avg/max = 0.0/0.0/0.0 ms

    100% loss

As the ping command can make a big package, wasted bandwidth of the target host; and hping command to quickly contract, occupancy cpu target host, some servers to shut down in response to the request of their functions. In fact, this is a simple way to attack the server.

traceroute command

After the probe to the target host gateways, routers were closed most of this function, and prevent attacks.

# traceroute www.baidu.com
traceroute to www.baidu.com (61.135.169.121), 30 hops max, 60 byte packets
 1  gateway (10.0.3.2)  0.249 ms  0.246 ms  0.247 ms
 2  gateway (10.0.3.2)  4.780 ms  4.627 ms  4.487 ms

ftp

The old file transfer protocol, ftp server using port 21

# ftp 192.168.4.22
然后提示输入fpt的用户名,可以匿名访问,匿名的话输入:anonymous或者ftp
然后提示输入密码,匿名用户就随便输入一个密码
然后就进入了ftp服务器了。
在里面可以使用ls,cd等命令
输入help,获取命令帮助。
get:下载一个文件
mget:下载多个文件
put/mput:上传一个/多个文件
rm/mrm:删除一个/多个文件

lftp command

Instead of ftp commands, supports command completion.

Enter help, get help command

Specify a username and password:lftp -u USERNAME,PASSWD 192.168.45.4

Not specify a user name and password (anonymous access):lftp 192.168.45.4

When anonymous access, does not need to enter anonymous or ftp

get: Downloads a file

mget: download multiple files

put / mput: upload one / file

rm / mrm: Delete one / file

lftpget command

Not log in to the ftp server, direct download. But only download files, you can not download directory.

Application layer protocol used is http

lftpget -c http://192.168.56.22/dir/file

HTTP: -c

wget command

Only download files, you can not download directory.

  • Downloads them in the background: -b

    This option is generally used in the script

  • Do not show the download progress: -q

  • HTTP: -c

  • After you specify the file to download, store to the local where: -O file

  • Specify the download rate (probably does not specify the maximum rate): --limit-rate amount =

c / c ++ mutual learning QQ group: 877 684 253

I micro letter: xiaoshitou5854

Guess you like

Origin www.cnblogs.com/xiaoshiwang/p/12334954.html