ping ,ifconfig ..简单的网络命令

网络:
ifconfig:查看网卡相关信息
    ifconfig eth0 up|down
    ifconfig eth0:1 192.168.1.100
    ip addr

    配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0

ping ,ifconfig ..简单的网络命令

ONBOOT=yes 设置为开机启动哦
route:查看路由表
    route -n
    route -add host|net
    route -del host|net


netstat:查看网络相关的详细信息
    netstat -anutlp|grep :22
    查看22号端口相关的网络信息
    netstat -anutlp|grep sshd
    查看进程名为sshd相关网络信息
    netstat -anutlp |grep 11112(PID)
    查看进程号为11112的网络相关信息

    通过进程号找到执行程序路径,有两种方式。
    lsof -p pid
    ll /proc/pid
arp:查看本机上的arp列表
    arp -a
    arp -s
    arp -d

arping:ping的时候显示MAC地址


nmap:扫描工具
    1) 获取远程主机的系统类型及开放端口

    nmap -sS -P0 -sV -O <target>

    2)在网络寻找所有在线主机

    nmap -sP 192.168.0.*
    
    3)显示目标主机的TCP
    nmap -sT 127.0.0.1

    4)显示目标主机UDP
    nmap -sU 127.0.0.1

ping:测试网络联通性
    ping -c
    ping -s


traceroute:测试到目标主机所经过的跳数(hops)
        traceroute -m
        traceroute -w
        traceroute -q
        traceroute -n

转载于:https://my.oschina.net/liubaizi/blog/752325