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

2017年03月20日 16:55:57 风来了- 阅读数:2291 标签: centoslinuxyumiproute 更多

个人分类: 系统|服务器|平台
 
版权声明:原创文章欢迎转载,不过要记得加出处哦 https://blog.csdn.net/wljk506/article/details/61916455

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

来自: 
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/

阅读更多

linux(Ubuntu/Centos) iproute 路由IP地址等命令集合,查看端口链接的更多相关文章

  1. Linux(CentOS)修改IP地址

    登陆连接centos系统,输入 ifconfig 可以查看到当前本机的IP地址信息 一 临时修改IP地址: 1.假如查询IP为1.118,输入 ifconfig eth0 (默认是第一个网卡) 后面接 ...

  2. ubuntu 查本机 ip地址的命令是什么, 详细信息的?

    使用ifconfig命令即可.你一敲进去都出来了

  3. 【liunx】使用xshell连接虚拟机上的CentOS 7,使用xhell连接本地虚拟机上的Ubuntu, 获取本地虚拟机中CentOS 7的IP地址,获取本地虚拟机中Ubuntu 的IP地址,Ubuntu开启22端口

    注意,如果想用xshell去连接本地虚拟机中的linux系统,需要本地虚拟机中的系统是启动的才能连接!!!!! ============================================ ...

  4. Linux系统下如何设置IP地址?

    Linux系统下如何设置IP地址?我们可以通过命令设定IP的方法,不过此方法的前提条件是用户需root权限.在linux系统的 /etc/sysconfig/network-script/ifcfg- ...

  5. ssh远程连接docker中linux(ubuntu/centos)

    ssh远程连接docker中linux(ubuntu/centos) https://www.jianshu.com/p/9e4d50ddc57e centos docker pull centos: ...

  6. Ubuntu配置和修改IP地址

    Ubuntu配置和修改IP地址 1.修改配置文件/etc/network/interfacesroot@ubuntu:~# sudo gedit /etc/network/interfaces 添加以 ...

  7. Linux环境下如何配置IP地址、MAC地址

    Linux环境下如何配置IP地址.MAC地址 1.配置IP地址 进入配置IP地址路径,进行修改即可 cd /etc/network vim interface 加入以下内容: iface eth0 i ...

  8. Linux下获取本机IP地址的代码

    Linux下获取本机IP地址的代码,返回值即为互联网标准点分格式的字符串. #define ETH_NAME "eth0" //获得本机IP地址 char* GetLocalAdd ...

  9. CentOS 修改固定IP地址

    CentOS 修改固定IP地址 参考地址:https://www.cnblogs.com/technology-huangyan/p/9146699.htmlhttps://blog.csdn.net ...

随机推荐

  1. Ruby attr_reader , attr_writer, attr_accessor方法

    attr_reader方法------读取实例变量 attr_writer方法------改写实例变量 attr_accessor方法-----读写实例变量 class Person attr_rea ...

  2. 洛谷 - P1141 - 01迷宫 - dfs

    https://www.luogu.org/problemnew/show/P1141 能互相到达的格子的答案自然是一样的,第一次dfs标记联通块,第二次dfs把cnt传递到整个联通卡并顺手消除vis ...

  3. hdoj2159【二位费用背包】

    题意: 略: 推荐看一下那个背包九讲,第五讲非常清晰啊. 原文: 算法 费用加了一维,只需状态也加一维即可.设f[i][v][u]表示前i件物品付出两种代价分别为v和u时可获得的最大价值.状态转移方程 ...

  4. (十)SpringBoot的文件上传

    一:添加commons-fileupload依赖 打开pom文件添加 <dependency> <groupId>commons-fileupload</groupId& ...

  5. 最小公倍数的最小和(Minimum Sum LCM )

    #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> u ...

  6. Caffe实战三(依赖包解析及环境配置)

    前面的文章使用的软件环境是开始时通过apt-get命令所安装的,本文将通过编译源码的方式重新配置一个可迁移的软件环境.(参考:<深度学习 21天实战Caffe> 第五天 Caffe依赖包解 ...

  7. AtCoder Grand Contest 015 E - Mr.Aoki Incubator

    题目传送门:https://agc015.contest.atcoder.jp/tasks/agc015_e 题目大意: 数轴上有\(N\)个点,每个点初始时在位置\(X_i\),以\(V_i\)的速 ...

  8. DataTable数据检索的性能分析[转]

    原文链接 作者写得非常好,我学到了许多东西,这里只是转载! 我们知道在.NET平台上有很多种数据存储,检索解决方案-ADO.NET Entity Framework,ASP.NET Dynamic D ...

  9. 当document.write 遇到外联script

    先来看个例子: <!DOCTYPE html> <html> <head> <title>测试 document.write</title> ...

  10. oracle常用数据类型&约束条件(及案例)

    一.数据类型 数据类型 说明 数字 number [小数,整数] number(5,3)表示总共5个数字,小数点后3个,最大值99.999 number(5) 表示整数  最大值99999    字符 ...