Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-06-2012, 03:26 AM
|
#1
|
|
LQ Newbie
Registered: Sep 2011
Posts: 4
Rep: 
|
ping to destination ip by using source ip
I want to ping destination public ip using source ip in the command line
How can i do that ?
|
|
|
|
09-06-2012, 03:52 AM
|
#2
|
|
LQ Newbie
Registered: Sep 2012
Location: Sweden
Posts: 16
Rep: 
|
How do you mean? Do you want to specify on which outgoing ip address/network interface you want to ping the destination?
You can specify the source interface (and address) with this parameter:
-I interface address
Set source address to specified interface address. Argument may be numeric IP address or name of device. When pinging IPv6 link-local address this option is required.
|
|
|
|
09-06-2012, 04:18 AM
|
#3
|
|
LQ Newbie
Registered: Sep 2011
Posts: 4
Original Poster
Rep: 
|
As an example think my i need to destination ip 172.16.1.11
and my source ip will be 10.100.1.20
i tried in this way : ping -c 5 -I 10.100.1.20 172.16.1.11
but this won't give the output.
My requirement is i need to ping destination IP that syntax includes the source IP also.
Can you provide proper syntax !
|
|
|
|
09-06-2012, 04:47 AM
|
#4
|
|
LQ Newbie
Registered: Sep 2012
Location: Sweden
Posts: 16
Rep: 
|
Ok, what do you mean you dont get any output? No text at all?
I dont have access to a linux terminal at the moment, but what you could do is to specify the network interface to use.
If you type ifconfig you should get a list of all the network interfaces. Then look for the one where your source ip address is at. Then you use that interface name as the parameter to the -I command.
for example:
ping -I eth0 xx.xx.xx.xx
/C
|
|
|
|
09-06-2012, 05:14 AM
|
#5
|
|
LQ Newbie
Registered: Sep 2011
Posts: 4
Original Poster
Rep: 
|
Hi krilleknug
I tried your mentioned command syntax before which is ping -I eth0 xx.xx.xx.xx
I won't give any output
|
|
|
|
09-06-2012, 05:25 AM
|
#6
|
|
LQ Newbie
Registered: Sep 2012
Location: Sweden
Posts: 16
Rep: 
|
Hi,
Ok, did your interface name was eth0 (from ifconfig)?
I think it will not respond until timing out if no response was given, so it could take a few seconds before there is any output.
Does ping work without the -I parameter?
/C
|
|
|
|
09-12-2012, 09:00 PM
|
#7
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:41 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|