HPE GreenLake Administration
- Community Home
 - >
 - Servers and Operating Systems
 - >
 - Operating Systems
 - >
 - Operating System - HP-UX
 - >
 - Re: how to write a ping program to ping arp table ...
 
Operating System - HP-UX
        1840188
        Members
    
    
        3793
        Online
    
    
        110162
        Solutions
    
Forums
        Categories
Company
Local Language
                
                  
                  back
                
        
                
        
                
        
                
        
        
        
                
        
                
        
        
        
                
        
              
              Forums
Discussions
Forums
- Data Protection and Retention
 - Entry Storage Systems
 - Legacy
 - Midrange and Enterprise Storage
 - Storage Networking
 - HPE Nimble Storage
 
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
                
                  
                  back
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
                
            
            
                
            
                
            
                
            
                
            
            
                
            
                
            
            
                
            
                
              
            Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
 - Appliance Servers
 - Alpha Servers
 - BackOffice Products
 - Internet Products
 - HPE 9000 and HPE e3000 Servers
 - Networking
 - Netservers
 - Secure OS Software for Linux
 - Server Management (Insight Manager 7)
 - Windows Server 2003
 - Operating System - Tru64 Unix
 - ProLiant Deployment and Provisioning
 - Linux-Based Community / Regional
 - Microsoft System Center Integration
 
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
        Information
        Community
Resources
Community Language
        Language
        Forums
Blogs
Topic Options
			
				
					
	
			
		
	- Subscribe to RSS Feed
 - Mark Topic as New
 - Mark Topic as Read
 - Float this Topic for Current User
 - Bookmark
 - Subscribe
 - Printer Friendly Page
 
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
09-06-2010 01:00 AM
09-06-2010 01:00 AM
			
				
					
						
							how to write a ping program to ping arp table ip
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						I would like to ping ip in arp table cache,
but i don't know how to write a ping program to detect arp table ip host is alive, does any one know how to scan ip from(arp table cache) via ping program ,could any one give me an example ,thanks
		
		
	
	
	
but i don't know how to write a ping program to detect arp table ip host is alive, does any one know how to scan ip from(arp table cache) via ping program ,could any one give me an example ,thanks
		3 REPLIES 3
	
	            
            
		
		
			
            
                - Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
09-06-2010 01:11 AM
09-06-2010 01:11 AM
			
				
					
						
							Re: how to write a ping program to ping arp table ip
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						eric,
how about something like this (tested on 11.31 - pings each address in the arp cache 3 times)
arp -an | cut -d'(' -f 2 | cut -d')' -f 1 | while read ip
do
ping ${ip} -n 3 >/dev/null 2>&1
[ $? -ne 0 ] && echo "Couldn't reach ${ip}"
done
HTH
Duncan
	
I am an HPE Employee
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
how about something like this (tested on 11.31 - pings each address in the arp cache 3 times)
arp -an | cut -d'(' -f 2 | cut -d')' -f 1 | while read ip
do
ping ${ip} -n 3 >/dev/null 2>&1
[ $? -ne 0 ] && echo "Couldn't reach ${ip}"
done
HTH
Duncan
I am an HPE Employee
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
09-06-2010 02:51 AM
09-06-2010 02:51 AM
			
				
					
						
							Re: how to write a ping program to ping arp table ip
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						thanks for your reply, i  would like to know if ping successful or not ,and when i run that program which shows nothing,
my HP-UX is B.11.31, and i am sure it has two arp record in arp table,and ping those ip which will response.
I would like to know if I need to write a c++ program to sure which ping status.
because i need to use program to check if host is live by that ip.
could any one tell me how to solve this IP Scan question.
Because i found i could use ECHO_REPLAY message to chech if ping is successful
thanks
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
my HP-UX is B.11.31, and i am sure it has two arp record in arp table,and ping those ip which will response.
I would like to know if I need to write a c++ program to sure which ping status.
because i need to use program to check if host is live by that ip.
could any one tell me how to solve this IP Scan question.
Because i found i could use ECHO_REPLAY message to chech if ping is successful
thanks
- Mark as New
 - Bookmark
 - Subscribe
 - Mute
 - Subscribe to RSS Feed
 - Permalink
 - Report Inappropriate Content
 
09-06-2010 03:09 AM
09-06-2010 03:09 AM
			
				
					
						
							Re: how to write a ping program to ping arp table ip
						
					
					
				
			
		
	
			
	
	
	
	
	
			
				
					
					
						Hi Eric,
indeed, if you want to write a ping program by hand, you need to open a AF_INET,SOCK_RAW socket, then pseudo- connect() to the target address,
send a ICMP_ECHO, and wait for ICMP_ECHO_REPLY.
or timeout with select()
					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
		
		
	
	
	
indeed, if you want to write a ping program by hand, you need to open a AF_INET,SOCK_RAW socket, then pseudo- connect() to the target address,
send a ICMP_ECHO, and wait for ICMP_ECHO_REPLY.
or timeout with select()
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
		
	
	
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP