linux 常用网络相关命令

常用网络命令

1.ping命令

ping www.woniuxy.com: 测试是否与woniuxy.com的服务器连通
ping -i 3 www.woniuxy.com: 每3秒钟访问一次
ping -c 5 www.woniuxy.com: 一共发送5个数据包
ping -f www.woniuxy.com: 快速发送ICMP数据包,进行压力测试(小心被封
ping -f -c 200 www.woniuxy.com: 设定具体的发包数量,用于快速检测响应时间等数据
ping -s 1024 www.woniuxy.com: 设定每个ICMP数据包的大小

ip命令

ip addr: 查看网卡及ip信息
ifconfig: 同上

ip neigh: ARP协议,查看相邻计算机
arp -an: 同上

ip link: 查看网卡MAC地址等

ip -s link: 查看网卡的收发数据包大小,RX:收,TX:发
ifconfig -s: 同上

ip addr add 192.168.112.225/24 dev ens33: 临时为ens33网卡添加一个ip地址,systemctl restart network 后消失
ifconfig ens33 192.168.122.225: 临时修改IP地址

ip addr del 192.168.112.225/24 dev ens33: 删除一个IP地址

查看路由IP地址:
ip route 或 route 或 netstat -r 或 route -n

ip route add default via 192.168.112.1: 为当前网络添加默认路由(网关)
route add default gw 192.168.112.1: 同上

ip route del default via 192.168.112.1: 删除路由地址
route del default gw 192.168.112.1: 同上

ip route flush cache: 刷新路由表

ip link set ens33 up : 启动网卡
ifconfig ens33 up: 同上, (down表示关闭)

ss -anl: 查看当前系统的端口占用情况
netstat -anlop: 同上

在这里插入图片描述
在这里插入图片描述

3.traceroute命令

Linux:
traceroute www.woniuxy.com : 跟踪到达woniuxy.com的所有路由节点和路径,默认支持30个跃点

Windows :
tracert www.woniuxy.com : 同上

4.curl命令

curl http://www.woniuxy.com/
curl -o woniuxy.html http://www.woniuxy.com/
curl -O http://www.woniuxy.com/train/index.html

5.wget命令

wget http://cn.wordpress.rorg/wordpress-4.9.4-zh_CN.tar.gz
wget -O wordpress.tar.gz http://cn.wordpress.rorg/wordpress-4.9.4-zh_CN.tar.gz
wget -c http://cn.wordpress.rorg/wordpress-4.9.4-zh_CN.tar.gz : 断点续传
wget -b http://cn.wordpress.rorg/wordpress-4.9.4-zh_CN.tar.gz : 后台下载

猜你喜欢

转载自blog.csdn.net/weixin_52385170/article/details/126081977