+----------+ Ping Request +----------+ | | <-------------- | | | Server A | | Server B | | | --------------> | | +----------+ Ping Response +----------+
Configuration to Allow ping from a Specific IP
Run the following configuration on Server A.
1 2 3
[Server A]# iptables -A INPUT -p icmp --icmp-type 8 -s <Server B の IP Address> -j ACCEPT [Server A]# iptables -A OUTPUT -p icmp --icmp-type 0 -s <Server B の IP Address> -j ACCEPT [Server A]# service iptables restart
--icmp-type 8 allows Echo request
--icmp-type 0 allows Echo Reply
Running ping from Server B
1 2 3 4 5 6 7 8 9 10
[Server B]# ping <Server A の IP Address>
PING (<Server A の IP Address>): 56 data bytes 64 bytes from (<Server A の IP Address>): icmp_seq=0 ttl=58 time=4.411 ms 64 bytes from (<Server A の IP Address>): icmp_seq=1 ttl=58 time=4.079 ms 64 bytes from (<Server A の IP Address>): icmp_seq=2 ttl=58 time=4.027 ms ^C --- (<Server A の IP Address>) ping statistics --- 3 packets transmitted, 3 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 4.027/4.172/4.411/0.170 ms