How can I find which NIC is used to talk to a given host (except traceroute)


 
Thread Tools Search this Thread
Operating Systems Solaris How can I find which NIC is used to talk to a given host (except traceroute)
# 1  
Old 03-21-2012
Question How can I find which NIC is used to talk to a given host (except traceroute)

Hi all,

I'm having some trouble identifying what route is being used to talk to a target host. I can figure it out by looking at the routing tables but I want to automate this and don't much feel like scripting the network mask logic when I'd think there'd be a way to have the OS do it for me.

I tried using traceroute and looking for the "Multiple interfaces found, using..." message, but that fails for some zones (no raw sockets).

Does anyone know of another way to display the first hop in the route (ie the NIC name or the NIC IP)?

Thanks in advance,
# 2  
Old 04-16-2012
Single bump, still can't figure a solution to this myself Smilie
Any ideas out there?
# 3  
Old 04-16-2012
I'm not a Solaris networking expert by any means, but I believe that the route command gives
you the interface that should be used:

Code:
route get <destination>

I don't know if there are exceptions or corner cases.

This output is from a virtual machine on my PC:

Code:
bash-3.2$ /sbin/ifconfig -a
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
e1000g0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
        inet 10.0.2.15 netmask ffffff00 broadcast 10.0.2.255
e1000g1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet 169.254.1.6 netmask ffff0000 broadcast 169.254.255.255
bash-3.2$ /sbin/route get 169.254.1.4
   route to: 169.254.1.4
destination: 169.254.0.0
       mask: 255.255.0.0
  interface: e1000g1
      flags: <UP,DONE>
 recvpipe  sendpipe  ssthresh    rtt,ms rttvar,ms  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0
bash-3.2$ /sbin/route get 10.0.2.16
   route to: 10.0.2.16
destination: 10.0.2.0
       mask: 255.255.255.0
  interface: e1000g0
      flags: <UP,DONE>
 recvpipe  sendpipe  ssthresh    rtt,ms rttvar,ms  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0


Last edited by radoulov; 04-16-2012 at 08:51 AM..
This User Gave Thanks to radoulov For This Post:
# 4  
Old 08-02-2012
MySQL

Quote:
Originally Posted by radoulov
I'm not a Solaris networking expert by any means, but I believe that the route command gives
you the interface that should be used:
Code:
route get <destination>

It seems to list the resultant route and interface nicely when I try it on Solaris

Nice one, thanks!
# 5  
Old 08-02-2012
Very nice, is there any equivalent to this for other systems?
# 6  
Old 08-02-2012
Quote:
Originally Posted by Corona688
Very nice, is there any equivalent to this for other systems?
On Linux using iproute2: ip route get <dest>
This User Gave Thanks to neutronscott For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Add two different subnet public IPs to single NIC or two different NIC on same box

Hello Admins, My ask is how can I add two different subnet IPs to same box with two different gateways? The issue is I can connect to the box when I am on ethernet LAN, but I am not able to connect to the same IP when I am on wifi. The server is RHEL 7 VM on vmware. How can I get connected... (4 Replies)
Discussion started by: snchaudhari2
4 Replies

2. Solaris

Network issue on multinic. Unable to ping a host from One NIC but other works

Dear, I hope you all will be ok. I have an issue with Solaris box running on x86 Blade. I am unable to ping a node neither traceroute. I am able to do traceroute from oce0:6 port which have IP and subnet of same type which oce0:1 has. details are as follows: Problem: root@rinams02:/#... (3 Replies)
Discussion started by: khaniqshahid
3 Replies

3. Red Hat

I want to tune NIC's rps, rfs and xps value. which NIC device should I modify.

Dear All I want tune my NIC's rps, rfs and xps value. In my system I have two NIC (eth0, eth1) and I have a bond0 ( eth0, eth1). Here is the question? Which device should I modify ? eth0 and eth1? or just modify bond0 or modify all device (eth0, eth1, bond0) Any advice is welcome.... (0 Replies)
Discussion started by: nnnnnnine
0 Replies

4. Solaris

x86 Solaris 10 nic driver added but not attached. NIC is not detected.

I couldn't install my nic in solaris 10. I compiled and added the driver but failed to attach the driver and ifconfig output shows only loopback dev. Please see the following output and tell me whether my nic has been detected and why the driver failed to attach? My nic is detected in linux... (0 Replies)
Discussion started by: vectrum
0 Replies

5. Solaris

able to ping all hosts but not able to traceroute any host

i am using solaris 10 and i am able to ping all the hosts but i am not able to traceroute any of them. how to fix this? (9 Replies)
Discussion started by: chidori
9 Replies

6. Solaris

Not able to find the new NIC

I have a Sun Blade 2500 with SUN 5.9 OS installed. I have one NIC built-in which is working fine. I insert another new NIC in the machine with four RJ45 connector options(means four NICs in one Card). The problem is i am not able to see the new NIC Thanks (13 Replies)
Discussion started by: z_haseeb
13 Replies

7. AIX

AIX -How to find which NIC is on which PCI card

Hi All, How can I find out which is ETH5 on my AIX P5 system. I have about seven different NIC card on this. I did move the cable to each one but still I was not able to see the link light up when I did netstat -v Any idea? Thanks. (2 Replies)
Discussion started by: samnyc
2 Replies

8. Solaris

Mulitple Zones on Dual NIC host

Greetings Forumers! I am running into an issue with multiple zones on an M5000 with 2 NICs. The NICs are on separate VLANs. These zones are using the 2 NICs to communicate with other systems but when they need to communicate with a zone on the same system, but different NIC, the application... (9 Replies)
Discussion started by: bluescreen
9 Replies

9. UNIX for Advanced & Expert Users

Help! How to find the local host after few ssh hops to remote host???

I do a ssh to remote host(A1) from local host(L1). I then ssh to another remote(A2) from A1. When I do a who -m from A2, I see the "connected from" as "A1". => who -m userid pts/2 2010-03-27 08:47 (A1) I want to identify who is the local host who initiated the connection to... (3 Replies)
Discussion started by: gomes1333
3 Replies

10. Solaris

How do I find what kind of NIC card the server has?

All, I see that there are 2 nic card available . How can I know all the details about these 2 nic cards. -rw-r--r-- 1 root root 10 Apr 16 15:00 hostname.bge0 -rw-r--r-- 1 root other 17 Apr 22 08:56 hostname.bge2 please let me know thanks -prasad (4 Replies)
Discussion started by: p4cldba
4 Replies
Login or Register to Ask a Question