Network Linux commands

I was ignorant about network commands, so I investigated what I used.

1.ping It is used to check if it is connected to the network or if a specific host is running. It sends a message to the other party, "Reply", and if the other party is alive, it will reply "I'm alive".

$ ping google.com
PING google.com (216.58.197.174): 56 data bytes
64 bytes from 216.58.197.174: icmp_seq=0 ttl=54 time=18.673 ms
64 bytes from 216.58.197.174: icmp_seq=1 ttl=54 time=18.657 ms
64 bytes from 216.58.197.174: icmp_seq=2 ttl=54 time=19.664 ms
64 bytes from 216.58.197.174: icmp_seq=3 ttl=54 time=17.743 ms

Ctrl + c

--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 17.743/18.684/19.664/0.679 ms

Explanation of the above execution results

4 packets transmitted <=Number of packets sent
4 packets received <=Number of received packets
0.0% packet loss <=Packet loss rate
round-trip min/avg/max/stddev = 17.743/18.684/19.664/0.679 ms <=The shortest time it took to send,Maximum time,Average time,Mean deviation

2.traceroute Display network routes. It is used when checking whether the network routing settings are correct.

$ traceroute dns.google
traceroute to dns.google (8.8.4.4), 64 hops max, 52 byte packets
 1  buffalo.setup (192.168.11.1)  1.169 ms  0.911 ms  0.728 ms <=Like a home router
 2  192.168.10.231 (192.168.10.231)  1.321 ms  1.918 ms  1.285 ms
 3  fkc-mx480-bbbas05.qtnet.ad.jp (218.40.227.148)  2.624 ms  3.535 ms  2.993 ms <=QT net-like
 4  * 211.9.102.37 (211.9.102.37)  3.830 ms
    211.9.102.33 (211.9.102.33)  3.186 ms
 5  61.203.192.241 (61.203.192.241)  2.853 ms  3.376 ms
    61.203.192.249 (61.203.192.249)  3.569 ms
 6  61.203.193.122 (61.203.193.122)  19.343 ms
    61.203.193.126 (61.203.193.126)  18.152 ms
    61.203.193.122 (61.203.193.122)  18.438 ms
 7  61.203.192.177 (61.203.192.177)  102.486 ms  57.606 ms  19.654 ms
 8  108.170.242.129 (108.170.242.129)  19.595 ms  20.212 ms
    108.170.242.193 (108.170.242.193)  56.511 ms
 9  66.249.95.155 (66.249.95.155)  24.191 ms
    108.170.233.77 (108.170.233.77)  19.702 ms
    72.14.233.221 (72.14.233.221)  19.364 ms
10  dns.google (8.8.4.4)  19.461 ms  19.845 ms  18.701 ms <=Arrived safely

3.host You can look up the IP address from the domain name, or conversely, look up the domain name from the IP address.

Ask for the IP address from the domain.

$ host dns.google
dns.google has address 8.8.4.4
dns.google has address 8.8.8.8
dns.google has IPv6 address 2001:4860:4860::8844
dns.google has IPv6 address 2001:4860:4860::8888

Ask for the domain from the IP address.

$ host 8.8.8.8
8.8.8.8.in-addr.arpa domain name pointer dns.google.

4.dig Get information about the host from the DNS server.

dig goole.com
; <<>> DiG 9.10.6 <<>> goole.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25027   <=Since it is NO ERROR, you can see that a normal response is returned
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:                         <=Inquiry
;goole.com.			IN	A

;; ANSWER SECTION:                           <=Answer to inquiry
goole.com.		1403	IN	A	217.160.0.201  <=IP address of the inquired host

;; Query time: 61 msec <=Time taken for inquiry
;; SERVER: 192.168.11.1#53(192.168.11.1)      <=IP address of the server that made the inquiry
;; WHEN: Tue Dec 10 00:53:07 JST 2019
;; MSG SIZE  rcvd: 54

You can also use the DNS server.

dig @dns.google google.com
 <<>> DiG 9.10.6 <<>> @dns.google google.com
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58341
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;google.com.			IN	A

;; ANSWER SECTION:
google.com.		299	IN	A	216.58.197.174

;; Query time: 86 msec
;; SERVER: 8.8.4.4#53(8.8.4.4)   <=The DNS server to use has changed
;; WHEN: Tue Dec 10 01:23:50 JST 2019
;; MSG SIZE  rcvd: 55

5.ifconfig

A command to check the IP address assigned to a network interface such as Ethernet, or to assign an IP address.

$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384  <=Loop back localhost 127.0.0.1
	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
	inet 127.0.0.1 netmask 0xff000000
	inet6 ::1 prefixlen 128
	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
	nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 <=Interface for IPv6 and IPv4 tunneling
stf0: flags=0<> mtu 1280				<=Interface for routing IPv6 packets to an IPv4 network
XHC20: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 <= Ethernet0 
	ether 4c:32:75:97:**:** 				                               <=Mac address
	inet6 fe80::410:c692:d02f:d432%en0 prefixlen 64 secured scopeid 0x5
	inet 192.168.11.3 netmask 0xffffff00 broadcast 192.168.11.255  <=IP address
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
	ether 0e:32:75:97:ab:2f
	media: autoselect
	status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
	ether fa:49:90:3f:a8:bb
	inet6 fe80::f849:90ff:fe3f:a8bb%awdl0 prefixlen 64 scopeid 0x7
	nd6 options=201<PERFORMNUD,DAD>
	media: autoselect
	status: active
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=60<TSO4,TSO6>
	ether 6a:00:02:ea:6b:10
	media: autoselect <full-duplex>
	status: inactive
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
	options=60<TSO4,TSO6>
	ether 6a:00:02:ea:6b:11
	media: autoselect <full-duplex>
	status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 <=Connect the virtual interface to an external network??
	options=63<RXCSUM,TXCSUM,TSO4,TSO6>
	ether 6a:00:02:ea:6b:10
	Configuration:
		id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
		maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
		root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
		ipfilter disabled flags 0x2
	member: en1 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 8 priority 0 path cost 0
	member: en2 flags=3<LEARNING,DISCOVER>
	        ifmaxaddr 0 port 9 priority 0 path cost 0
	nd6 options=201<PERFORMNUD,DAD>
	media: <unknown type>
	status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
	inet6 fe80::a83c:cb87:4ddf:f50b%utun0 prefixlen 64 scopeid 0xc
	nd6 options=201<PERFORMNUD,DAD>
utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
	inet6 fe80::55d3:d20b:a62c:e19c%utun1 prefixlen 64 scopeid 0xd
	nd6 options=201<PERFORMNUD,DAD>

6.telnet Use this when you want to check if the network service is running.

↓ I set up my own web server.

$ telnet 127.0.0.1 8887
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
GET /

HTTP/1.1 200 OK <=response
content-length: 7
accept-ranges: bytes
connection: keep-alive
content-type: text/html; charset=utf-8

HELLO <=Contents of html file

Connection closed by foreign host.

Summary

I was in great trouble when I was wondering if the web server was alive, where did it stop, or if the port was open, so I will continue to investigate.

Recommended Posts

Network Linux commands
Linux commands
Linux commands
linux commands
Linux commands
Linux commands
Verbalize Linux commands
Linux user commands
New Linux commands! !!
Basic LINUX commands
Linux Network Namespace
Various Linux commands
Typical Linux commands (7)
Frequently used Linux commands
Frequently used Linux commands
Frequently used linux commands
[Linux] Group related commands
Linux commands to remember
New Linux commands! !! Part 2
Network (mainly Linux) notes
Studying Linux commands and frustration
Linux
network
Introduction to Linux Commands ~ LS-DYNA Edition ~
Basic knowledge of Linux and basic commands
Linux Frequently Used Commands [Personal Memo]
Handle dates in Linux bash commands
[Linux Mint 20] Various WiFi confirmation commands
[Linux] Frequently used Linux commands (file operation)
Road to Linux Intermediate: Network Edition
Convenient shortcut keys for Linux commands! !! !!
Frequently used Linux commands (for beginners)
Linux commands that you often forget
[Linux] File and directory operation commands
List of frequently used Linux commands
Try compiling Linux commands (cross-compilation practice)
Linux commands related to character code
[Linux] Frequently used Linux commands (folder operation)
About Linux commands Super basic edition
Note: Linux concepts and minimum commands
Use Linux commands on Android devices
Operate Linux Network Namespace with Go
linux memorandum
Linux command # 4
Create your own Linux commands in Python
Linux command # 3
Linux overview
[Linux] Review of frequently used basic commands 2
Linux basics
direnv (linux)
[Linux] Summary of middleware version confirmation commands
[Linux] List of Linux commands used in practice
Organize Linux
Linux practice
Ubuntu Linux 20.04
Linux Summary
Linux process
Quick reference table: Linux disk related commands
Linux permissions
Tools used to check Linux network communication
Basic commands