In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
1. Ifconfig command
Ifconfig is a command used to display or configure network devices (network interface cards) in linux. The English full name is network interfaces configuring.
1. Ifconfig-a
[root@test1 yum.repos.d] # ifconfig-a
Eth0 Link encap:Ethernet HWaddr 00:0C:29:1F:06:D4
Inet addr:192.168.1.108 Bcast:192.168.1.255 Mask:255.255.255.0
Inet6 addr: fe80::20c:29ff:fe1f:6d4/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:227870 errors:0 dropped:0 overruns:0 frame:0
TX packets:22314 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:1000
RX bytes:29699855 (28.3 MiB) TX bytes:5637694 (5.3 MiB)
Lo Link encap:Local Loopback
Inet addr:127.0.0.1 Mask:255.0.0.0
Inet6 addr: 1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:184 errors:0 dropped:0 overruns:0 frame:0
TX packets:184 errors:0 dropped:0 overruns:0 carrier:0
Collisions:0 txqueuelen:0
RX bytes:12878 (12.5 KiB) TX bytes:12878 (12.5 KiB)
[root@test1 yum.repos.d] #
Through this command, you can see the ip address and mac address of the network card, as well as the lo loopback address.
First line: connection type: Ethernet (Ethernet) HWaddr (hardware mac address)
Second line: IP address, subnet, mask of the network card
Line 3: UP (for network card on status) RUNNING (network cable for network card is connected) MULTICAST (support for multicast) MTU:1500 (maximum transmission unit): 1500 bytes
Fourth and fifth elements: statistics of receiving and sending packets
Line 7: receive and send data byte statistics.
2. Ifconfig interface [up | down] / / start or disable the interface
3. Ifconfig interface IP/mask / / set the ip address for the interface
4. Ifconfig interface-alias IP/mask / / set the ip address for the interface alias; effective immediately
II. Route
View: route-n
Add: route add
Route add [- net |-host] target [netmask Nm] [gw Gw] [[dev] If]
Destination: 192.168.1.3 Gateway: 172.16.0.1
~] # route add-host 192.168.1.3 gw 172.16.0.1 dev eth0
Destination: 192.168.0.0 Gateway: 172.16.0.1
~] # route add-net 192.168.0.0 netmask 255.255.255.0 gw 172.16.0.1 dev eth0
~] # route add-net 192.168.0.0 gw 24 gw 172.16.0.1 dev eth0
Default route, gateway: 172.16.0.1
~] # route add-net 0.0.0.0 netmask 0.0.0.0 gw 172.16.0.1
~] # route add default gw 172.16.0.1
Delete: route del
Route del [- net |-host] target [gw Gw] [netmask Nm] [[dev] If]
Destination: 192.168.1.3 Gateway: 172.16.0.1
~] # route del-host 192.168.1.3
Destination: 192.168.0.0 Gateway: 172.16.0.1
~] # route del-net 192.168.0.0 netmask 255.255.255.0
III. Netstat
Netstat-Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
Show network connections:
Netstat [--tcp |-t] [--udp |-- raw |-w] [--listening |-l] [--all |-a] [--numeric |-n] [--extend |-e [--extend |-e]] [--program |-p]
-t: related to tcp protocol
-u: related to udp protocol
-w: raw socket related
-l: in monitoring state
-a: all statu
-n: display IP and port in numbers
-e: extended format
-p: displays related processes and PID
Common combinations:
-tan.-uan.-tnl.-unl.
Display the routing table:
Netstat {--route |-r} [--numeric |-n]
-r: displays the kernel routing table
-n: numeric format
Display interface statistics:
Netstat {--interfaces |-I |-I} [iface] [--all |-a] [--extend |-e] [--program |-p] [--numeric |-n]
# netstat-I
# netstat-I IFACE
IV. Ip
Linux's ip command is similar to ifconfig, but the former is more powerful and is designed to replace the latter
Ip-show / manipulate routing, devices, policy routing and tunnels
Ip [OPTIONS] OBJECT {COMMAND | help}
OBJECT: = {link | addr | route}
Link OBJECT:
Ip link-network device configuration
Set
Dev IFACE
Properties can be set:
Up and down: activates or disables the specified interface
Show
[dev IFACE]: specify the interface
[up]: only interfaces that are active are displayed
Ip address-protocol address management
Ip addr {add | del} IFADDR dev STRING
[label LABEL]: indicates the alias of the network card when adding an address
[scope {global | link | host}]: indicates the scope
Global: globally available
Link: only links are available
Host: available locally
[broadcast ADDRESS]: indicates the broadcast address
Ip address show-look at protocol addresses
[dev DEVICE]
[label PATTERN]
[primary and secondary]
Ip address flush-flush protocol addresses
Use the same format as show
Ip route-routing table management
Ip route add
Add Route: ip route add TARGET via GW dev IFACE src SOURCE_IP
TARGET:
Host routing: IP
Network routing: NETWORK/MASK
Add Gateway: ip route add defalt via GW dev IFACE
Ip route delete
Delete route: ip route del TARGET
Ip route show
Ip route flush
[dev IFACE]
[via PREFIX]
5. Ss
Ss is the abbreviation of Socket Statistics. As the name implies, the ss command can be used to get socket statistics, which can display something similar to netstat. But the advantage of ss is that it can display more and more detailed information about TCP and connection status, and is faster and more efficient than netstat.
Format: ss [OPTION]... [FILTER]
Options:
-t: related to tcp protocol
-u: related to udp protocol
-w: bare socket related
-x:unix sock related
-l: connection with listen statu
-a: all
-n: numeric format
-p: related programs and PID
-e: extended information
-m: memory usage
-o: timer information
The running result is clear at a glance, and the speed is very fast.
[root@test1 yum.repos.d] # ss-tanlp
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128: 22: * users: ("sshd", 1813pr. 4)
LISTEN 0 128 *: 22 *: * users: ("sshd", 1813 jade 3)
LISTEN 0 128: 40470: * users: ("rpc.statd", 1635. 11)
LISTEN 0 128 127.0.0.1 LISTEN 631 *: * users: ("cupsd", 1673 Magne7))
LISTEN 0 128:: 1 LISTEN 631: * users: ("cupsd", 1673 Magne6))
LISTEN 0 100:: 1:25: * users: ("master", 1990, 13)
LISTEN 0 100 127.0.0.1 LISTEN 25 *: * users: ("master", 1990 Magi 12))
LISTEN 0 128: 58524: * users: ("rpc.mountd", 3684. 14)
LISTEN 0 64:: 2049: *
LISTEN 0 64 *: 2049 *: *
LISTEN 0 128: 45697: * users: ("rpc.mountd", 3684 users 18)
LISTEN 0 64 *: 42242 *: *
LISTEN 0 128 *: 44843 *: * users: ("rpc.mountd", 368 4pr 16)
LISTEN 0128 *: 875 *: * users: ("rpc.rquotad", 3679pr. 4)
LISTEN 0 128 *: 55244 *: * users: ("rpc.mountd", 368 4pr 8)
LISTEN 0 64:: 59629: *
LISTEN 0128 *: 33549 *: * users: (("rpc.mountd", 3684, 12))
LISTEN 0128 *: 53679 *: * users: ("rpc.statd", 1635pr. 9)
LISTEN 0 128: 111: * users: (("rpcbind", 1517))
LISTEN 0128 *: 111l *: * users: ("rpcbind", 1517pr 8)
LISTEN 0 128: 42480: * users: (("rpc.mountd", 3684, 10))
[root@test1 yum.repos.d] #
VI. Nmcli
Nmcli [OPTIONS] OBJECT {COMMAND | help}
Device-show and manage network interfaces
Connection-start, stop, and manage network connections
How to modify attributes such as IP address:
# nmcli connection modify IFACE [+ | -] setting.property value
Setting.property:
Ipv4.addresses
Ipv4.gateway
Ipv4.dns1
Ipv4.method
Manual
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.