LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Closed Thread
 
LinkBack Search this Thread
Old 09-06-2012, 03:26 AM   #1
minipop4747
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Rep: Reputation: Disabled
Thumbs up 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 ?
 
Old 09-06-2012, 03:52 AM   #2
krilleknug
LQ Newbie
 
Registered: Sep 2012
Location: Sweden
Posts: 16

Rep: Reputation: Disabled
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.
 
Old 09-06-2012, 04:18 AM   #3
minipop4747
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Question

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 !
 
Old 09-06-2012, 04:47 AM   #4
krilleknug
LQ Newbie
 
Registered: Sep 2012
Location: Sweden
Posts: 16

Rep: Reputation: Disabled
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
 
Old 09-06-2012, 05:14 AM   #5
minipop4747
LQ Newbie
 
Registered: Sep 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Exclamation

Hi krilleknug

I tried your mentioned command syntax before which is ping -I eth0 xx.xx.xx.xx

I won't give any output
 
Old 09-06-2012, 05:25 AM   #6
krilleknug
LQ Newbie
 
Registered: Sep 2012
Location: Sweden
Posts: 16

Rep: Reputation: Disabled
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
 
Old 09-12-2012, 09:00 PM   #7
jschiwal
Moderator
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652Reputation: 652
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.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ping to destination ip by using source ip minipop4747 Linux - Newbie 2 09-06-2012 11:34 AM
Ping a destination server passing by a certain gateway madpsycho Linux - Networking 2 11-16-2011 11:42 AM
Ping: Destination Host Unreachable parashuram2011 Linux - Networking 3 10-21-2011 03:27 PM
Destination Host Unreachable - can't ping Modem IP chleng88 Linux - Networking 3 09-17-2008 12:12 PM
when ping I get Destination host unreachable Fuzia Linux - Networking 1 06-19-2006 01:22 AM


All times are GMT -5. The time now is 12:41 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration