telnet

远程登陆与tcp探测

telnet是tcp协议,无法探测udp协议

  1. telnet www.baidu.com 443

ssh

使用SSH加密协议远程登录

  1. # 非交互式

scp

ssh协议主机之间复制文件

  1. # 非交互式

rsync

文件同步,支持本地、远程

  1. rsync -a -e "ssh" /Users/cola/Documents/vuepress/blog/ 139.155.0.213:/opt/
  2. rsync -avz -e 'ssh -p 20000' ./num.php 114.215.80.214:/root/
  3. ,并检查本地/ceshi目录,如果被备份主机的ssh端口修改过,则修改为"ssh -P XXXX"

wget

命令行下载文件

  1. #静默模式,不显示下载进度
  2. wget -q

ping

测试主机之间网络的连通性

  1. ping www.baidu.com
  2. ping -c 1 -w 1 www.baidu.com

route

显示和设置linux系统的路由表

  1. # 添加到主机的路由
  2. route add -host 192.168.1.123 dev eth0
  3. route add -host 192.168.1.123 gw 192.168.1.1
  4. # 添加到网络的路由
  5. route add -net 192.168.1.123 netmask 255.255.255.0 eth0
  6. route add -net 192.168.1.123 netmask 255.255.255.0 gw 192.168.1.1
  7. route add -net 192.168.1.123 netmask 255.255.255.0 gw 192.168.1.1 eth1
  8. route add -net 192.168.1.0/24 eth1
  9. # 添加默认网关
  10. route add default gw 192.168.1.1
  11. # 删除路由
  12. route del -host 192.168.1.11 dev eth0
  13. route del -net 192.168.1.123 netmask 255.255.255.0

永久写入到路由表
对于网络的服务,不要写入到rc.local开机文件,因为网络服务是在rc.local文件之前配置的

创建/etc/sysconfig/static-routes文件

  1. any net 192.168.1.0/24 gw 192.168.1.24
  2. any net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1

ifconfig

查看、配置、启用或禁用网络接口的命令

  1. # 查看当前系统中存活的网络接口设备信息
  2. ifconfig
  3. # 查看当前系统中存活的网络接口设备信息
  4. ifconfig eth1
  5. # 查看所有网络接口设备(通过此命令,非运行状态的网卡也可显示)
  6. ifconfig -a
  7. # 启动指定网络接口设备
  8. ifconfig eth1 up
  9. # 关闭指定网络接口设备
  10. ifconfig eth1 down
  11. ifconfig eth1 add 33ffe:3240:800:1005::2/64:为指定网络接口设备添加IPv6地址          
  12. ifconfig eth1 del 33ffe:3240:800:1005::2/64:为指定网络接口设备删除IPv6地址           ifconfig eth# hw ether 00:16:3E:10:60:B5 : 修改指定网络接口设备MAC地址
  13. ifconfig eth# xxx.xxx.xxx.xx:给指定网络接口设备配置指定ip地址  
  14. ifconfig eth# xxx.xxx.xxx.xx netmask 255.255.255.0 :给指定网络接口设备配置指定ip地址及子网掩码                 
  15. # 给指定网络接口设备配置指定ip地址及子网掩码、广播地址
  16. ifconfig eth1 192.168.120.100 netmask 255.255.255.0 broadcast 192.168.120.255
  17. # 给指定网络接口设备设置最大传输单元
  18. ifconfig eth1 mtu 1500

ifup

启动网卡

ifdown

关闭网卡

netstat

查看网络状态

ss

查看网络状

nmap

网络扫描命令

lsof

全名list open files,也就是列举系统中已经被打开的文件

  1. lsof

mail 发送和接收邮件

mutt 邮件管理命令

nslookup

交互式查询互联网DNS服务器的命令

  1. nslookup -type=os www.baidu.com

dig

查找DNS解析过程

host

查询DNS的命令

traceroute

追踪数据传输路由状况

tcpdump

令行的抓包工具


瓦雀