การตรวจสอบหมายเลข IP Address ที่ใช้งาน

ตรวจสอบหมายเลข IP Address

การตรวจสอบหมายเลข IP Address ที่ใช้งานผู้ดูแลระบบสามารถใช้คำสั่งต่างๆดังนี้

ip addr
ip a
ip a | grep inet
ip r l
hostname -I
hostname -I | cut -d' ' -f1
ifconfig
ifconfig enp0s3

------------------EXAMPLE---------------------
[root@logs ~]# ip a
1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:23:e5:1f brd ff:ff:ff:ff:ff:ff
inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
valid_lft 80018sec preferred_lft 80018sec
inet 10.0.2.16/24 brd 10.0.2.255 scope global secondary noprefixroute enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::591b:6147:fedc:a325/64 scope link noprefixroute
valid_lft forever preferred_lft forever

------------------EXAMPLE---------------------
[root@logs ~]# ip a | grep inet
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 10.0.2.15/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
inet 10.0.2.16/24 brd 10.0.2.255 scope global secondary noprefixroute enp0s3
inet6 fe80::591b:6147:fedc:a325/64 scope link noprefixroute

------------------EXAMPLE---------------------
[root@logs ~]# ip r l
default via 10.0.2.2 dev enp0s3 proto static metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.15 metric 100
10.0.2.0/24 dev enp0s3 proto kernel scope link src 10.0.2.16 metric 100

------------------EXAMPLE---------------------
[root@logs ~]# hostname -I
10.0.2.15 10.0.2.16

------------------EXAMPLE---------------------
[root@logs ~]# ifconfig
enp0s3: flags=4163 mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::591b:6147:fedc:a325 prefixlen 64 scopeid 0x20
ether 08:00:27:23:e5:1f txqueuelen 1000 (Ethernet)
RX packets 3012 bytes 289416 (282.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2402 bytes 450471 (439.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 4539 bytes 1029058 (1004.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4539 bytes 1029058 (1004.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

------------------EXAMPLE---------------------
root@logs ~]# ifconfig enp0s3
enp0s3: flags=4163 mtu 1500
inet 10.0.2.15 netmask 255.255.255.0 broadcast 10.0.2.255
inet6 fe80::591b:6147:fedc:a325 prefixlen 64 scopeid 0x20
ether 08:00:27:23:e5:1f txqueuelen 1000 (Ethernet)
RX packets 12886 bytes 12433629 (11.8 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4180 bytes 627139 (612.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

--
Write by Dr.Arnut Ruttanatirakul
(c) 2018 by SysAdmin Knowledge
http://www.sysadmin.in.th
November 16, 2018