Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Commonly used network management tools

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

What are the commonly used network management tools and describe how to use them in the form of examples.

Ifconfig command

# ifconfig-a

# ifconfig INTERFACE [up | down]

Ifconfiginterface [aftype] options | address...

# ifconfig INTERFACE IP/mask [up]

# ifconfig INTERFACE IP netmask MASK

Route command

View: route-n

Add: route add

Routeadd [- net |-host] target [netmask Nm] [gw Gw] [[dev] If]

Add:

Route add [- net |-host] target [netmask Nm] [gw GW] [[dev] If]

Example: route add-net 10.0.0.0 gw 8 gw 192.168.10.1 dev eth2

Route add-net 0.0.0.0amp 0.0.0.0 gw192.168.10.1

Route add default gw 192.168.10.1

Delete:

Route del [- net |-host] target [gw Gw] [netmask Nm] [[dev] If]

Example: route del-net 10.0.0.0 gw 8 gw 192.168.10.1

Route del default

Netstat command

Printnetwork connections, routing tables, interface statistics, masqueradeconnections, and multicast memberships

Show routing table: netstat-rn

-r: displays the kernel routing table

-n: numeric format

Show network connections:

Netstat [--tcp |-t] [--udp |-- udplite |-U] [--sctp |-S] [--raw |-w] [--listening |-l] [--all |-a] [--numeric |-n] [--extend |-e [--extend |-e] [--program |-p]

-t:TCP protocol related connections, all connections have their own status; FSM (Finate State Machine)

-u:UDP related connections

-w:raw socket related connections

-l: a connection in the listening state

-a: all statu

-n: display IP and Port in digital format

-e: extended format

-p: displays related processes and PID

Common combinations:

-tan,-uan,-tnl,-unl,-tunlp

Transport layer protocols:

Tcp: a connection-oriented protocol; establish a virtual link before the communication starts, and dismantle the connection after the communication is completed

Udp: connectionless protocol; sending data messages directly

Displays the statistics of the interface:

Netstat {- interfaces |-I |-I} [iface] [--all |-a] [--extend |-e] [--verbose |-v] [--program |-p] [--numeric |-n]

All interfaces:

Netstat-I

Specify the interface:

Netstat-I

Ip command

Show/ manipulate routing, devices, policy routing and tunnels

Ip [OPTIONS] OBJECT {COMMAND | help}

OBJECT:= {link | addr | route | netns}

Note: OBJECT can be abbreviated, and so can the subcommands of each OBJECT.

Ip OBJECT:

Iplink: network device configuration

Ip link set-change device attributes

DevNAME (default): indicates the device to be managed. The dev keyword can be omitted.

Up and down:

Multicaston or multicast off: enable or disable multicast featur

NameNAME: rename interfac

MtuNUMBER: sets the size of MTU. Default is 1500.

NetnsPID:ns is namespace and is used to move the interface to the specified network namespace

Ip link show-display device attributes

Ip link help-displays brief usage help

Ip netns:-manage network namespaces.

Ip netns list: list all netns

Ip netns add NAME: creates the specified netns

Ip netns del NAME: deletes the specified netns

Ip netns exec NAME COMMAND: runs the command in the specified netns

Ipaddress-protocol address management.

Ipaddress add-add new protocol address

Ip addr add IFADDR dev IFACE

[labelNAME]: indicates the interface alias for the additional address

[broadcastADDRESS]: broadcast address; will be calculated automatically based on IP and NETMASK

[scopeSCOPE_VALUE]:

Global: globally available

Link: API is available

Host: only available locally

Ipaddress delete-delete protocol address

Ipaddr delete IFADDR dev IFACE

Ipaddress show-look at protocol addresses

Ip addr list [IFACE]: displays the address of the interface

Ipaddress flush-flush protocol addresses

Ip addr flush dev IFACE

Ip route command

Iproute-routing table management

Iproute add-add new route

Iproute change-change route

Iproute replace-change or add new one

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

Example:

# ip route add 192.168.0.0/24 via10.0.0.1 dev eth2 src 10.0.20.100

# ip route add default via GW

Iproute delete-delete route

Ip route del TYPE PRIFIX

Example:

# 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

Ip route get TYPE PRIFIX

Example: iproute get 192.168.0.0Comp24

Ss command:

Ss [options] [FILTER]

Options:

-related connections of t:TCP protocol

-u:UDP related connections

-w:raw socket related connections

-l: connection for listening statu

-a: connections for all statu

-n: numeric format

-p: related programs and their PID

-e: extended format information

-m: memory usage

-o: timer information

FILTER:= [state TCP-STATE] [EXPRESSION]

Common status of TCP:

TCPFSM:

LISTEN: monitoring

ESTABLISEHD: established connection

FIN_WAIT_1:

FIN_WAIT_2:

SYN_SENT:

SYN_RECV:

CLOSED:

EXPRESSION:

Dport=

Sport=

Example:'(dport =: 22 or sport =: 22)'

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

~] # ss-tan state ESTABLISHED

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report