net-tools对比iproute2
简介
iproute2是linux下管理控制TCP/IP网络和流量控制的新一代工具包,旨在替代老派的工具链net-tools,即大家比较熟悉的ifconfig,arp,route,netstat等命令。
net-tools是通过procfs(/proc)和ioctl系统调用去访问和改变内核网络配置,而iproute2则通过netlink套接字接口与内核通讯。
对照表
| net-tools | iproute2 | |
|---|---|---|
| arp -na | ip neigh | 显示ARP缓存 |
| ifconfig | ip link | 网络设备配置 |
| ifconfig -a | ip addr show | 查询所有已连接的网络接口 |
| ifconfig -s | ip -s link | 显示网络接口统计数据 |
| ifconfig eth0 up | ip link set eth0 up | 启停动接口 |
| ipmaddr | ip maddr | 多播地址管理 |
| iptunnel | ip tunnel | 隧道配置 |
| netstat | ss | socket统计信息 |
| netstat -i | ip -s link | |
| netstat -g | ip maddr | |
| netstat -l | ss -l | |
| netstat -r | ip route | |
| route add | ip route add | |
| route del | ip route del | |
| route -n | ip route show |
ss常用操作
-s查看当前服务器的网络连接统计
ss -s-l查看所有监听的网络端口,-p并列出具体的程序名称
ss -lp-a查看这台服务器上所有的socket连接
ss -a替代netstat -ntlp
ss -nltp|column -t替代lsof -i
ss -nltp|grep 18010ip常用操作
检查网卡的诸如 IP 地址
ip addr show
ip a启用/禁用网卡
ip link set eth0 up
ip link set eth0 down配置IP地址
ip addr add 10.211.55.13/24 brd + dev eth0
ip addr del 10.211.55.13/24 dev eth0检查路由
ip route show检查ARP记录
ip neigh来源:bluexiii


Comments | NOTHING