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


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

版權聲明:原創文章歡迎轉載,不過要記得加出處哦 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/

閱讀更多


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM