linux网络dns配置查看命令,网络配置——命令家族

iproute2家族:

ip命令:

show / manipulate routing, devices, policy routing and tunnels

ip [ OPTIONS ] OBJECT { COMMAND | help }

OBJECT = { link | addr | route  }

注意OBJECT可简写,格OBJECT的子命令也可简写

·ip link:network device configuration

ip link set – change device attributes

dev NAME (default):指明要管理的设备,dev关键字可省略

up 和 down:启动或关闭网络接口

multicast on 或 multicast off:启用或关闭多播功能

name NAME:重命名接口    //必须先down掉接口,才能该名

mtu NUMBER:设置MTU的大小,默认为1500

netns PID:ns为namespace,用于将接口移动到指定的网络名称空间

ip link show – display device attributes

ip link help – 显示简要使用帮助

·ip netns:ip – manage network namespaces

ip netns list:列出所有的netns

ip netns add NAME:创建指定的netns

ip netns del NAME:删除指定的netns

ip netns exec NAME COMMAND:在指定的netns中运行命令

·ip address-protocol address management

ip address add – add new protocol address

ip addr add IFADDR dev IFACE

[label NAME]:为额外添加的地址指明接口别名

在ifconfig命令中,没有别名的ip地址默认不显示

[broadcast ADDRESS]:广播地址,不设置会根据IP和NETMASK自动计算得到

[scope SCOPE_VELUE]:

global:全局可用

link:接口可用

host:仅主机可用

ip address del – delete protocol address

ip addr delete IFADDR dev IFACE

ip address show – look at protocol addresses

[IFACE]:仅显示指定接口的地址

ip address flush – flush protocol address

ip addr fulsh dev IFACE

·ip route – routing tabel management

ip route add – add new route

ip route change – change route

ip route replace – change or add new one

ip route add TYPE PREFIX via GW [dev IFACE] [src SOURCE_IP]

eg: #ip route add 192.158.0.0/24 via 10.0.0.1 dev eth1 src 10.0.20.100

#ip route add default via GW

ip route delete – delete route

ip route del TYPE PREFIX

eg: #ip route delete 192.168.1.0/24

ip route show – list routes

TYPE PREFIX

ip route flush – flush routing tables

TYPE PREFIX

ip route get – get a single route

ip route get TYPE PREFIX

eg: #ip route get 192.168.0.0/24

ss命令:

ss [options] [FILTER]

选项:

-t:TCP协议的相关链接

-u:UDP协议的相关链接

-w:raw socket相关的链接

-l:监听状态的链接

-a:所有的链接

-n:数字格式

-p:相关的进程及其PID

-e:扩展格式信息

-m:内存用量

-o:计时器信息

FILTER= [ state TCP-STATE ] [ EXPRESSION ]

TCP的常见状态:

TCP FSM:

LISTEN:监听

ESTABLISEHD:建立的链接

FIN_WAIT_1

FIN_WAIT_2

SYN_SENT

SYN_RECV

CLOSED:关闭的链接

EXPRESSION:

dport=

sport=

示例:'( dport = :22 or sport = :22 )'

#ss -tan '( dport = :22 or sport = :22 )'

#ss -tan state ESTABLISHED

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值