서버에 새로운 Red Hat 상자를 설치했습니다.
IP와 서버 이름을 사용하여 네트워크의 다른 컴퓨터에 ping을 보낼 수 있지만 localhost, 127.0.0.1 또는 192.168.4.42(로컬 IP)는 사용할 수 없습니다.
[root@comp2 ~]# ping comp1
PING vcas1 (192.168.4.41) 56(84) bytes of data.
64 bytes from vcas1 (192.168.4.41): icmp_seq=1 ttl=64 time=0.104 ms
64 bytes from vcas1 (192.168.4.41): icmp_seq=2 ttl=64 time=0.100 ms
--- comp1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.100/0.102/0.104/0.002 ms
[root@comp2 ~]#
[root@comp2 ~]# ping 192.168.4.41
PING 192.168.4.41 (192.168.4.41) 56(84) bytes of data.
64 bytes from 192.168.4.41: icmp_seq=1 ttl=64 time=0.119 ms
64 bytes from 192.168.4.41: icmp_seq=2 ttl=64 time=0.105 ms
--- 192.168.4.41 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.105/0.112/0.119/0.007 ms
하지만 localhost나 로컬 IP 주소를 ping할 수는 없습니다.
[root@comp2 ~]# ping 192.168.4.42
PING 192.168.4.42 (192.168.4.42) 56(84) bytes of data.
--- 192.168.4.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
PING comp2 (192.168.4.42) 56(84) bytes of data.
--- comp2 ping statistics ---
17 packets transmitted, 0 received, 100% packet loss, time 15999ms
[root@comp2 ~]# ping 192.168.4.42
PING 192.168.4.42 (192.168.4.42) 56(84) bytes of data.
--- 192.168.4.42 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
[root@comp2 ~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
--- localhost.localdomain ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 1999ms
이것은 내 /etc/hosts입니다.
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.4.41 comp1
192.168.4.42 comp2
마지막으로 이것은 내 ifconfig입니다.
[root@comp2 ~]# /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:26:55:D4:4E:81
inet addr:10.0.0.14 Bcast:10.127.255.255 Mask:255.128.0.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:271591 errors:0 dropped:0 overruns:0 frame:0
TX packets:3079 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:16571921 (15.8 MiB) TX bytes:228424 (223.0 KiB)
Memory:fbfa0000-fbfc0000
eth1 Link encap:Ethernet HWaddr 00:26:55:D4:4E:80
inet addr:192.168.4.42 Bcast:192.168.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:174349 errors:0 dropped:0 overruns:0 frame:0
TX packets:34537 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:12202232 (11.6 MiB) TX bytes:3230241 (3.0 MiB)
Memory:fbfe0000-fc000000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:16398 errors:0 dropped:0 overruns:0 frame:0
TX packets:16398 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:829344 (809.9 KiB) TX bytes:829344 (809.9 KiB)
어떻게 되어가나요?
편집하다:
[root@comp2 ~]# /sbin/iptables -F
[root@comp2 ~]# /etc/init.d/iptables stop
Flushing firewall rules: [ OK ]
Setting chains to policy ACCEPT: filter [ OK ]
Unloading iptables modules: [ OK ]
[root@comp2 ~]# ping localhost
PING localhost.localdomain (127.0.0.1) 56(84) bytes of data.
--- localhost.localdomain ping statistics ---
6 packets transmitted, 0 received, 100% packet loss, time 4999ms
아직 아무것도 없습니다.
[root@comp2 ~]#/sbin/ip route show
192.168.4.0/24 dev eth1 proto kernel scope link src 192.168.4.42
169.254.0.0/16 dev eth1 scope link
10.0.0.0/9 dev eth0 proto kernel scope link src 10.0.0.14
default via 10.0.0.1 dev eth0
[root@comp2 ~]# /sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.4.0 * 255.255.255.0 U 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
10.0.0.0 * 255.128.0.0 U 0 0 0 eth0
default VideoGateway.Om 0.0.0.0 UG 0 0 0 eth0
새로운:
이 작업을 수행했어야 했지만 다시 comp1 서버(192.168.4.41)에서 comp2(192.168.4.42)를 ping할 수 없습니다.
답변1
필요한 것은 라우팅 테이블 재구성이다. 업데이트 GATEWAY
되는 변수입니다 /etc/sysconfig/networking-scripts/ifcfg-ethX
. /etc/sysconfig/networking-scripts/route-ethX
경로 정보도 업데이트해야 합니다. 올바른 네트워크 구성으로 파일을 업데이트한 후 재부팅하여 새 네트워크 구성이 인터페이스에 적용되도록 하세요 network
./sbin/service network restart
답변2
다음 명령의 출력을 확인하십시오.
cat /proc/sys/net/ipv4/icmp_echo_ignore_all
1이면 다음을 수행하십시오.
echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
영구적으로 저장하려면 다음을 수행하십시오.
echo "net.ipv4.icmp_echo_ignore_all=0" >> /etc/sysctl.conf
값이 icmp_echo_ignore_all
1이면 커널은 ICMP ECHO 요청을 무시합니다. 일부 시스템 관리자는 핑 플러드( ping -f
)를 방지하기 위해 핑 응답을 비활성화합니다.
답변3
lo
귀하의 인터페이스가 아직 표시되지 않은 것 같습니다 . 다음 명령을 시도해 보십시오:
ifup lo
또는
ifup -a