zoukankan      html  css  js  c++  java
  • Shell笔记——网络操作

    wget 下载网页或者远程文件

    # 下载限速:
    wget --limit-rate 20k www.baidu.com
    
    # 断点续传:
    wget -c URL

    允许/禁止ping

    # 禁止ICMP协议
    
    # 临时生效:
    # 允许ping
    echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
    # 禁止
    echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
    
    # 永久生效
    /etc/sysctl.conf
    # 允许:增加一行
    net.ipv4.icmp_echo_ignore_all=0
    # 禁止
    net.ipv4.icmp_echo_ignore_all=1
    
    # 修改完 
    sysctl -p

    fping 查看局域网活动主机

    fping -a 192.168.0.1 192.168.0.255 -g
    
    # 如果对方关闭icmp协议,那么此命令将搜索不到对方

    sshfs 在本地挂载点上挂载远程驱动器

    # 需要安装fuse-sshfs.x86_64
    # fuse 用户空间文件系统(Filesystem in Userspace)
    
    sshfs -o allow_other hz@101.132.185.243:/home/hz/shellTest /mnt/sshpoint/

    lsof 列出系统中开放端口以及运行在端口上的服务信息

    lsof -i

    netcat或者nc 创建网络套接字

    # 套接字 ip:端口号
    
    # 设置监听套接字
    nc -l 1234
    
    # 连接到该套接字
    nc 101.132.185.243 1234

    iptables 制作简易防火墙

    # 阻塞发送到特定ip地址的流量
    iptables -A OUTPUT -d 114.114.114.114 -j DROP
    
    # 阻塞发送到特定端口的流量
    iptables -A OUTPUT -p tcp -dport 21 -j DROP
    
    # 清除改动
    iptables --flush

    iptables -L -n --line-numbers
    iptables -D INPUT 6

    连接windows共享文件夹

    # 通过文件管理器连接
    smb://IP
    
    # 通过命令挂载
    yum install -y cifs-utils
    sudo mount.cifs //IP/文件名 /mnt/share -o user=username
    mount.cifs //196.192.168.98/xunyou /usr/local/xunyou -o user=administrator,dir_mode=0777,file_mode=0777
    
    # 查看有哪些共享目录
    smbclient -L //IP -U username
    

      

  • 相关阅读:
    spring-cloud-gateway动态路由
    spring-cloud-gateway静态路由
    activiti6官方示例笔记
    spring-cloud-gateway过滤器实践
    spring-cloud-gateway简介
    设计模式--策略模式
    学习ConcurrentHashMap1.7分段锁原理
    SpringBoot Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
    MYSQL触发器的使用
    储存过程 (创建,调用,查询,删除)
  • 原文地址:https://www.cnblogs.com/Vince-blogs/p/9310592.html
Copyright © 2011-2022 走看看