Linux Unix

[ Linux ] IP (ip v4) 확인 하기

정윤재 2019. 10. 22. 01:30

1. hostname 사용

shell> hostname -I

(대문자 I (아이))

 

[root@testcentos bin]# hostname -I
192.168.122.1

 

2. ip addr show (show 는 생략 가능함) : inet 뒤를 확인

 

shell> ip addr show

 

[root@testcentos bin]# ip addr show
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: ens33: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:a1:32:a2 brd ff:ff:ff:ff:ff:ff
3: virbr0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 52:54:00:89:ba:3d brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
link/ether 52:54:00:89:ba:3d brd ff:ff:ff:ff:ff:ff

 

3. ifconfig 사용 : inet 뒤를 확인

 

[root@testcentos bin]# ifconfig
ens33: flags=4163 mtu 1500
ether 00:0c:29:a1:32:a2 txqueuelen 1000 (Ethernet)
RX packets 504 bytes 31200 (30.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
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 1461 bytes 125259 (122.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1461 bytes 125259 (122.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099 mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:89:ba:3d txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0