常用的网络管理类工具有哪些,并用示例形式描述他们的使用方法。ifconfig命令 #ifconfig -a #ifconfig INTERFACE [up|down] ifconfiginterface [aftype] options | address … #ifconfig INTERFACE IP/mask [up] #ifconfig INTERFACE IP netmask MASKroute命令 查看:route -n 添加:route add routeadd [-net|-host] target [netmask Nm] [gw Gw] [[dev] If]添加: route add[-net|-host] target [netmaskNm] [gw GW] [[dev] If] 示例:route add-net 10.0.0.0/8 gw192.168.10.1 dev eth2 route add -net0.0.0.0/0.0.0.0 gw192.168.10.1 route add defaultgw 192.168.10.1 删除: route del[-net|-host] target [gw Gw] [netmask Nm][[dev] If] 示例:route del -net10.0.0.0/8 gw 192.168.10.1 routedel defaultnetstat命令 Printnetwork connections, routing tables, interface statistics, masqueradeconnections, and multicast memberships 显示路由表:netstat -rn -r:显示内核路由表 -n:数字格式 显示网络连接: netstat [–tcp|-t][–udp|-u] [–udplite|-U] [–sctp|-S][–raw|-w] [–listening|-l] [–all|-a][–numeric|-n][–extend|-e[–extend|-e]][–program|-p] -t:TCP协议的相关连接,连接均有其状态;FSM(Finate State Machine); -u:UDP相关的连接 -w:raw socket相关的连接 -l:处于监听状态的连接 -a:所有状态 -n:以数字格式显示IP和Port; -e:扩展格式 -p:显示相关的进程及PID;常用组合:-tan, -uan,-tnl, -unl, -tunlp传输层协议: tcp:面向连接的协议;通信开始之前,要建立一个虚链路;通信完成后还要拆除连接; udp:无连接的协议;直接发送数据报文;显示接口的统计数据: netstat {–interfaces|-I|-i} [iface][–all|-a] [–extend|-e] [–verbose|-v] [–program|-p] [–numeric|-n] 所有接口: netstat -i指定接口: netstat -Iip命令 show/ manipulate routing, devices, policy routing and tunnels ip[ OPTIONS ] OBJECT { COMMAND | help } OBJECT:= { link | addr | route | netns } 注意: OBJECT可简写,各OBJECT的子命令也可简写; ip OBJECT: iplink: network device configuration ip linkset – change device attributes devNAME (default):指明要管理的设备,dev关键字可省略; up和down: multicaston或multicast off:启用或禁用多播功能; nameNAME:重命名接口 mtuNUMBER:设置MTU的大小,默认为1500; netnsPID:ns为namespace,用于将接口移动到指定的网络名称空间; ip linkshow – display device attributes ip linkhelp – 显示简要使用帮助; ip netns: – manage network namespaces. ip netnslist:列出所有的netns ip netnsadd NAME:创建指定的netns ip netnsdel NAME:删除指定的netns ip netnsexec NAME COMMAND:在指定的netns中运行命令 ipaddress – protocol address management. ipaddress add – add new protocol address ip addradd IFADDR devIFACE [labelNAME]:为额外添加的地址指明接口别名; [broadcastADDRESS]:广播地址;会根据IP和NETMASK自动计算得到; [scopeSCOPE_VALUE]: global:全局可用; link:接口可用; host:仅本机可用 ipaddress delete – delete protocol address ipaddr delete IFADDRdev IFACE ipaddress show – look at protocol addresses ip addrlist [IFACE]:显示接口的地址; ipaddress flush – flush protocol addresses ip addrflush dev IFACEip route 命令 iproute – routing table management iproute add – add new route iproute change – change route iproute replace – change or add new one ip routeadd TYPE PREFIX via GW[dev IFACE] [src SOURCE_IP] 示例: #ip route add 192.168.0.0/24 via10.0.0.1 dev eth2 src 10.0.20.100 #ip routeadd default via GW iproute delete – delete route ip routedel TYPE PRIFIX 示例: #ip route delete 192.168.1.0/24 iproute show – list routes TYPEPRIFIX iproute flush – flush routing tables TYPE PRIFIX iproute get – get a single route iproute get TYPE PRIFIX 示例:iproute get 192.168.0.0/24ss命令: ss [options][ FILTER ]选项: -t:TCP协议的相关连接 -u:UDP相关的连接 -w:raw socket相关的连接 -l:监听状态的连接 -a:所有状态的连接 -n:数字格式 -p:相关的程序及其PID -e:扩展格式信息 免费云主机域名 -m:内存用量 -o:计时器信息 FILTER:= [ state TCP-STATE ] [ EXPRESSION ] TCP的常见状态: TCPFSM: 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 -tanstate ESTABLISHED
相关推荐: linux中sda与sdb有哪些区别
这篇文章主要介绍了linux中sda与sdb有哪些区别的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇linux中sda与sdb有哪些区别文章都会有所收获,下面我们一起来看看吧。 linux中sda与sdb的区别是:sda表示的是s…
免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。