프린트 하기 URL 복사

OS 환경 : Oracle Linux 8.7 (64bit)

 

DB 환경 : Oracle Database 19.27.0.0

 

에러 : ping: ora19fs: Name or service not known

/etc/hosts에 등록된 내 hostname으로 ping이 안가는 문제

1
2
# ping ora19fs
ping: ora19fs: Name or service not known

 

 

ip로 ping 시도

1
2
3
4
5
6
7
8
# ping 192.168.137.50
PING 192.168.137.50 (192.168.137.5056(84) bytes of data.
64 bytes from 192.168.137.50: icmp_seq=1 ttl=64 time=0.034 ms
64 bytes from 192.168.137.50: icmp_seq=2 ttl=64 time=0.023 ms
^C
--- 192.168.137.50 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.023/0.028/0.034/0.007 ms

ip로는 ping이 잘 나감

 

 

/etc/hosts 파일 확인

1
2
3
4
# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.137.50 ora19fs

서버 ip와 hostname이 등록되어 있음

 

 

ifconfig 확인

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.137.50  netmask 255.255.255.255  broadcast 0.0.0.0
        inet6 fe80::250:56ff:fea8:5e35  prefixlen 64  scopeid 0x20<link>
        ether 00:50:56:a8:5e:35  txqueuelen 1000  (Ethernet)
        RX packets 8396264  bytes 23773996360 (22.1 GiB)
        RX errors 0  dropped 105  overruns 0  frame 0
        TX packets 4015031  bytes 287037135 (273.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 154082  bytes 7592832 (7.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 154082  bytes 7592832 (7.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ip도 /etc/hosts 등록한 ip가 맞음

 

 

/etc/resolv.conf 파일 dns 정보 확인

1
2
3
4
# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 8.8.4.4

정상임

 

 

외부 ping 확인

1
2
3
4
5
6
7
8
# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.856(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=113 time=32.6 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=113 time=32.5 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 32.516/32.540/32.564/0.024 ms

정상임

 

 

hostname 확인

1
2
# hostname
ora19fs

/etc/hosts 등록한 hostname(ora19fs)이 맞음

 

 

해결 방법 : /etc/nsswitch.conf에서 hosts 주석 해제

/etc/nsswitch.conf 파일 확인

1
2
3
4
5
6
# cat /etc/nsswitch.conf | grep host
#     hosts: files dns
#     hosts: files dns  # from user file
# Valid databases are: aliases, ethers, group, gshadow, hosts,
#       myhostname              Use systemd host names
#hosts:      files dns myhostname

여기서 hosts 부분이 주석처리 되어있음

 

 

/etc/nsswitch.conf 파일 수정

1
2
# vi /etc/nsswitch.conf
hosts:      files dns myhostname

hosts 부분 주석 해제

 

 

다시 ping 확인

1
2
3
4
5
6
7
8
# ping ora19fs
PING ora19fs (192.168.137.5056(84) bytes of data.
64 bytes from ora19fs (192.168.137.50): icmp_seq=1 ttl=64 time=0.035 ms
64 bytes from ora19fs (192.168.137.50): icmp_seq=2 ttl=64 time=0.023 ms
^C
--- ora19fs ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1024ms
rtt min/avg/max/mdev = 0.023/0.029/0.035/0.006 ms

정상적으로 hostname으로도 ping이 잘감

 

원인 : /etc/nsswitch.conf의 hosts 부분의 주석

이전에 테스트를 하다가 /etc/nsswitch.conf의 hosts 부분을 주석처리 해놓아서 발생한 문제
주석을 해제한 뒤 정상화됨

 

 

 

 

 

참조 : 

PRVF-0002 : could not retrieve local node name ( https://positivemh.tistory.com/738 )