linux如何查ip路由端口,linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接...

Centos 安装

yum install iproute iproute-doc

1

Ubuntu 安装

apt-get install iproute iproute-doc

1

风.fox

说明

net-tools

iproute2

邻居

arp -na

arp

ip neigh

地址和链路配置

ifconfig

ip link

ip addr

显示全部接口信息

显示IP

ifconfig -a

ip addr show

帮助

ifconfig –help

ip help

显示摘要信息

ifconfig -s

ip -s link

启动指定网络设备/网卡

ifconfig eth0 up

ip link set eth0 up

组播

ipmaddr

ip maddr

ip隧道

iptunnel

ip tunnel

统计

netstat

ss

显示网络界面信息表单

netstat -i

ip -s link

显示多重广播功能群组组员名单

netstat -g

ip maddr

列出监听服务状态

netstat -l

ss -l

路由表

netstat -r

route

ip route

添加路由

route add

ip route add

删除路由

route del

ip route del

查看路由状态

route -n

ip route show

增删VLAN

vconfig

ip link

显示当前监听端口

ss -pltn

1

以下全部是转载

ip地址管理

1.显示ip地址

ip a

ip address show

ip addr show dev eth0

ip a sh eth0

1

2

3

4

2.增加删除地址

ip address add 192.0.2.1/24 dev eth0

ip addr del 192.0.2.2/24 dev eth0

1

2

3.显示接口统计

ip -s link ls eth0

1

网卡和链路配置

4.显示链路

ip link show

ip link sh eth0

1

2

4.修改接口状态

ip link set eth0 up

ip link s gre01 down

1

2

路由表管理

5.显示路由表

ip route

ip ro show dev gre01

1

2

6.增加新路由

ip route add 10.2.2.128/27 dev gre01

1

7.增加默认路由

ip route add default via 192.168.1.1

1

8.修改默认路由

ip route chg default via 192.168.1.2

1

9.删除默认路由

ip route del default

1

隧道配置

10.增加删除GRE隧道

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

ip tunnel del gre01

1

2

11.IPIP隧道

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

1

12.显示隧道

ip tunnel show

1

13.显示隧道统计

ip -s tunl ls gre01

1

邻居和arp表管理

13.查看arp表

ip neigh show

1

14.手工增加删除arp项

ip neighbor add 10.2.2.2 dev eth0

ip neigh del 10.2.2.1 dev eth0

1

2

socket统计

15.显示当前监听

ss -l

1

15.显示当前监听的进程

ss -p

1

查看端口链接

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

lsof -n -iTCP:80 | grep LISTEN

lsof -n -i:80 | grep LISTEN

1

2

3

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

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

lsof -nP -iTCP:$PORT | grep LISTEN

lsof -nP -i:$PORT | grep LISTEN

1

2

3

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值