linux系统网络命令ifconfig-route-ip-ss
来源:互联网 发布:mac os sierra壁纸 编辑:程序博客网 时间:2024/06/06 06:52
1.ifconfig常用命令
ifconfig {interface} {up|down} #开启或关闭端口
ifconfig 列出当前已经启动网卡配置状态
ifconfig eth0 192.168.1.100 netmask 255.255.255.0
ifconfig eth0:0 192.168.1.101 netmask 255.255.255.0 # eth0上再绑一个IP
注:ifconfig配置的内容在系统重启后会丢失掉,想永久使用则需要修改系统的网络配置文件。
如:
DEVICE=eth0
HWADDR=8C:89:A5:18:AF:CB
TYPE=Ethernet
UUID=c5540694-31d7-4f58-a476-828ebd597582
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=172.16.10.2
NETMASK=255.255.0.0
GATEWAY=172.16.0.1
2.route常用命令
route -n #打印路由表,以ip形式
route add default gw 192.168.1.1 #增加默认路由
route add [-net|-host] [网段或主机] netmask [gw|dev]
route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1 #增加到192.168.1.0网段的路由
route del-net 192.168.1.0 netmask 255.255.255.0 dev eth0 #删除
3.ip命令
网上找到一篇比较详细的,有与ifconfig相关命令的对比。此外不再重复。
4.ss命令
这是iproute2里的一个套件,可用于替代netstat命令。
netstat是遍历/proc下面每个PID目录,ss直接读/proc/net下面的统计信息。所以ss执行的时候消耗资源以及消耗的时间都比netstat少很多
ss 选项
Usage: ss [ OPTIONS ]
ss [ OPTIONS ] [ FILTER ]
-h, --help #帮助信息
-V, --version output version information #版本信息
-n, --numeric don't resolve service names #不做dns解析
-r, --resolve resolve host names #以主机名形式显示
-a, --all display all sockets #所有套接字信息
-l, --listening display listening sockets #列出监听端口信息
-o, --options show timer information # 显示时间信息
-e, --extended show detailed socket information # 详细信息
-m, --memory show socket memory usage # 显示内存使用情况
-p, --processes show process using socket #显示使用端口的进程
-i, --info show internal TCP information
-s, --summary show socket usage summary # 统计端口信息
-4, --ipv4 display only IP version 4 sockets #只显示ipv4的连接
-6, --ipv6 display only IP version 6 sockets #只显示ipv6的连接
-0, --packet display PACKET sockets
-t, --tcp display only TCP sockets #显示tcp连接
-u, --udp display only UDP sockets #显示udp
-d, --dccp display only DCCP sockets
-w, --raw display only RAW sockets
-x, --unix display only Unix domain sockets #显示unix连接
-f, --family=FAMILY display sockets of type FAMILY
-A, --query=QUERY, --socket=QUERY
QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY]
-D, --diag=FILE Dump raw information about TCP sockets to FILE
-F, --filter=FILE read filter information from FILE
FILTER := [ state TCP-STATE ] [ EXPRESSION ]
使用:
ss -s # 显示socket简要信息
ss -l #列出所有监听端口
ss -ln
ss -t -a #tcp连接
ss -pl
ss -u -a
ss -o state established '( dport = :http or sport = :http )' #列出established 状态的httpd连接
0 0
- linux系统网络命令ifconfig-route-ip-ss
- linux网络配置命令之ifconfig、ip和route
- linux网络配置命令之ifconfig、ip和route
- linux网络配置命令之ifconfig、ip和route
- linux网络配置命令ip(ifconfig+route)小结
- linux 网络设置 命令 ifconfig route
- 设置网络参数命令--ifconfig,route,ip,ifup,ifdown
- 网络基础知识、linux路由管理命令(route) 、ip命令、ifconfig命令的使用、linux网卡配置
- Linux网络配置之一 ifconfig、route、netstat命令详解
- Linux shell 命令 -- route, ifconfig
- linux网络命令 ss
- linux 网络命令ifconfig
- linux网络命令 ifconfig
- Linux ip命令、ifconfig命令
- 鸟哥 服务器 笔记: Linux 常用的网络命令 route ifconfig ifup ifdown
- linux网络命令 route
- Linux命令:ifconfig对应ip
- linux查看ip命令--ifconfig
- 设计模式六大原则
- Git push与pull的默认行为
- 22. Generate Parentheses
- 解决MyEclipse10里project facet Dynamic web module to不能选择 2.5或3.0的问题
- vi/vim基本使用方法
- linux系统网络命令ifconfig-route-ip-ss
- 对象——基础概念第一层
- 进程线程 到 异步编程
- 查看获取MD5和SHA1值(应用签名)*
- 如何获取底部虚拟按键栏的高度
- Java并发编程:Lock
- HTTP协议详解
- MongoDB分布式设计-主从复制,副本集
- iOS 工厂模式