Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

i have 3 network cards , 1 Lan (wired) , 1 wireless network card & 1 is wireless usb

how do i ping from specific network card ?

& how do i use specific network card for specific application


i want to ping google from wlan0 

example for specific application

i want to use firefox or transmission from wan1


Lan ip > Working Properly enter image description here

Wlan1 ip

enter image description here

pin -I wlan1


Try pasting the output of route -n and/or ip route. Seems to me that the wlan1 interface hasn't a valid gateway configured. –@MrShunz

one@onezero:~$ route -n 
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0     U     1000   0        0 eth0   U     0      0        0 vmnet8   U     1      0        0 eth0   U     2      0        0 wlan1   U     0      0        0 vmnet1
one@onezero:~$ ip route
default via dev eth0  proto static dev eth0  scope link  metric 1000 dev vmnet8  proto kernel  scope link  src dev eth0  proto kernel  scope link  src  metric 1 dev wlan1  proto kernel  scope link  src  metric 2 dev vmnet1  proto kernel  scope link  src 
share|improve this question
Try pasting the output of route -n and/or ip route. Seems to me that the wlan1 interface hasn't a valid gateway configured. – Mr Shunz Jan 29 '12 at 13:46
@MrShunz > UPDATED – One Zero Jan 29 '12 at 14:57
i updated my answer accordingly – Mr Shunz Jan 30 '12 at 9:18

1 Answer 1

up vote 5 down vote accepted

ping has a specific switch to set source interface: -I. As found in the manpage:

 -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.

As an example

$ ping -I wlan0

ping through wlan0 interface.

Forcing an interface for a specific application needs some more work. You can find a solution in this question and in this article linked in the answer.


The methods i exposed in this answer show how to force ping to use a specific interface. And links to some articles on how to force a generic program to use a specific interface.

Now, for all this to work, you have to configure some "advanced" routing. As you can see from the output of route -n you have multiple networks, but only ONE gateway to the Internet. That is good, as multiple gateway routing is quite an advanced topic and somewhat difficult to handle well.

This goes beyond what you asked in the original question. I suggest you to post a new question here or on Server Fault asking how to configure and manage multiple internet gateways on multiple network interfaces.

Or, better yet, try googling it ;) Also check the LARTC site for advanced linux routing configurations.

share|improve this answer
From icmp_seq=2 Destination Host Unreachable – One Zero Jan 28 '12 at 23:59
@OneZero That means you cannot reach destination. Is the address of wlan0? Does exists a gateway configured for that interface? – Mr Shunz Jan 29 '12 at 0:12
> Updated changed the ip 8 to 3 of wlan static .. – One Zero Jan 29 '12 at 8:36
thankyou....... – One Zero Jan 30 '12 at 14:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.