linux(UbuntuCentos) iproute 路由IP地址等命令集合,查看端口链接

    xiaoxiao2021-03-25  83

    Centos 安装

    yum install iproute iproute-doc

    Ubuntu 安装

    apt-get install iproute iproute-doc

    风.fox

    说明net-toolsiproute2邻居arp -naarpip neigh地址和链路配置ifconfigip linkip addr显示全部接口信息显示IPifconfig -aip addr show帮助ifconfig –helpip help显示摘要信息ifconfig -sip -s link启动指定网络设备/网卡ifconfig eth0 upip link set eth0 up组播ipmaddrip maddrip隧道iptunnelip tunnel统计netstatss显示网络界面信息表单netstat -iip -s link显示多重广播功能群组组员名单netstat -gip maddr列出监听服务状态netstat -lss -l路由表netstat -rrouteip route添加路由route addip route add删除路由route delip route del查看路由状态route -nip route show增删VLANvconfigip link

    显示当前监听端口

    ss -pltn

    以下全部是转载

    ip地址管理

    1.显示ip地址

    ip a ip address show ip addr show dev eth0 ip a sh eth0

    2.增加删除地址

    ip address add 192.0.2.1/24 dev eth0 ip addr del 192.0.2.2/24 dev eth0

    3.显示接口统计

    ip -s link ls eth0

    网卡和链路配置

    4.显示链路

    ip link show ip link sh eth0

    4.修改接口状态

    ip link set eth0 up ip link s gre01 down

    路由表管理

    5.显示路由表

    ip route ip ro show dev gre01

    6.增加新路由

    ip route add 10.2.2.128/27 dev gre01

    7.增加默认路由

    ip route add default via 192.168.1.1

    8.修改默认路由

    ip route chg default via 192.168.1.2

    9.删除默认路由

    ip route del default

    隧道配置

    10.增加删除GRE隧道

    ip tunnel add gre01 mode gre local 10.1.1.1 remote 20.2.2.1 ttl 255 ip tunnel del gre01

    11.IPIP隧道

    ip tunl a ipip01 mode ipip local 10.1.1.1 remote 20.2.2.1 ttl 255

    12.显示隧道

    ip tunnel show

    13.显示隧道统计

    ip -s tunl ls gre01

    邻居和arp表管理

    13.查看arp表

    ip neigh show

    14.手工增加删除arp项

    ip neighbor add 10.2.2.2 dev eth0 ip neigh del 10.2.2.1 dev eth0

    socket统计

    15.显示当前监听

    ss -l

    15.显示当前监听的进程

    ss -p

    查看端口链接

    lsof -n -i4TCP:80 | grep LISTEN # Verified on macOS Sierra lsof -n -iTCP:80 | grep LISTEN lsof -n -i:80 | grep LISTEN

    为了不显示端口的俗称,你可以加P参数:

    lsof -nP -i4TCP:$PORT | grep LISTEN # Verified on macOS Sierra lsof -nP -iTCP:$PORT | grep LISTEN lsof -nP -i:$PORT | grep LISTEN

    来自: http://www.jianshu.com/p/125fbe9dc1d2 http://blog.csdn.net/kevin3101/article/details/52368860 http://linoxide.com/linux-command/use-ip-command-linux/ http://colobu.com/2017/07/11/show-connections-in-MACOS/

    转载请注明原文地址: https://ju.6miu.com/read-40768.html

    最新回复(0)