Sponsored Content
Operating Systems HP-UX How to determine network interface that will be used to send a packet for an IP Post 302411612 by foxrafi on Friday 9th of April 2010 01:53:05 PM
Old 04-09-2010
Bug How to determine network interface that will be used to send a packet for an IP

Hello,
I'm writing to you because I encountered the following problem. My program displayes all network interfaces that are available in the system, but I would like to add a functionality in which a user can enter a destination address IP (ex. the IP address of the Google search engine) and will get information which network interface will be used to send it. As I know it is associated with reading information from routing table in the system. Maybe you know the API (functions/methods) which I could use to do it in HP-UX ? I program in C/C++, but if you know how to do it in other programming languages (Java, Perl, Python) I will be grateful for any information.

Thank you for any help, tips and suggestions.

Best regards,
Foxrafi

---------- Post updated at 12:53 PM ---------- Previous update was at 01:55 AM ----------

Just to share with you what I've already learnt. On Solaris there is a command: "route get <ip address>" which shows the network interface that will be used for network communication with this IP address. Example:
route get 9.168.23.12.
As source code for OpenSolaris is available publicly it shouldn't be difficult to find what system calls are used to it, I think so.

I've also found a short discussion about this topic on the HP-UX forum: here .
It turns out that on HP-UX you're not able to achieve it in a simple way.

If you have any other ideas how solve my problem Smilie, I will appreciate that.
 

10 More Discussions You Might Find Interesting

1. Programming

determine if a ethernet interface is up

Howto check if a ethernet interface is up? It's impossible to determine via the ipaddress i have learned, or? Can someone please give me a hint on howto do? Environment == Linux x86 GNU GCC. :D regards Esaia (2 Replies)
Discussion started by: Esaia
2 Replies

2. IP Networking

How to determine the interface?

Given the interfaces on a firewall: eth0 Link encap:Ethernet HWaddr 02:40:67:34:F5:47 inet addr:192.168.0.1 Bcast:192.168.0.255 Mask:255.255.255.0 eth1 Link encap:Ethernet HWaddr 86:23:98:45:35:56 inet addr:123.45.240.69 Bcast:255.255.255.255 ... (2 Replies)
Discussion started by: kikikaka
2 Replies

3. Solaris

Determine Solaris box network interface?

Given a new Solaris box, with a fresh, unconfigured install on it, how does one figure out what kind of network interface it has (bge,le, hme, etc)? (8 Replies)
Discussion started by: akbar
8 Replies

4. HP-UX

how to get network packet size

how to get network packet size I would like get network output rate(kb/sec) I type command "netstat -i" Ipkts Ierrs Opkts Oerrs 653387 0 678202 0 but i didn't know what is it packet size , how could i get it? (1 Reply)
Discussion started by: alert0919
1 Replies

5. Solaris

Packet loss on ce interface.

Hi, I am using the ce interface on my Solaris 9 server and there is significant packet loss when transmitting large packets. Does anyone have a fix for this? ----10.1.0.0 PING Statistics---- 51 packets transmitted, 42 packets received, 17% packet loss round-trip (ms) min/avg/max =... (12 Replies)
Discussion started by: sparcman
12 Replies

6. Solaris

No network cable But Network interface is UP and Running

I've one Netra 240 After changing main board and system configuration card reader, Network is not accessible any more, Network interfaces are always UP and Running even when there is no cable connected to Network interfaces. I tried to restart and plumb/unplumb with no luck. ifconfig -a... (7 Replies)
Discussion started by: samer.odeh
7 Replies

7. UNIX for Dummies Questions & Answers

Adding a network interface to a bonded interface

I have a RHEL 5 system with a bonded interface configure using only one network port (eth0). So I have config file for ifcfg-bond0 and ifcfg-eth. I'd like to configure eth5 to be the second SLAVE in the bond. My question is, after I modify ifcfg-eth5, can I add eth5 to the bond0 interface without... (1 Reply)
Discussion started by: westmoreland
1 Replies

8. Shell Programming and Scripting

Bash- Determine what interface is online

Hey guys, I want to use a a quick bash script/command to determine what network interface is connected to the internet so I can pipe it out to become a variable, in order so the user does not have to manually type it in each time or have to 'hardcode' the variable into the script. I know about... (6 Replies)
Discussion started by: 3therk1ll
6 Replies

9. Solaris

Determine PCI Endpoint for a Serial Interface.

Hi Folks, Here is one for the real Solaris aficionados on the site; I have a T5240 and have to create an I/O domain with access to the serial port, in this case /dev/term/a and although I have been through the documentation I'm having some issues in identifying the device to assign. What I... (2 Replies)
Discussion started by: gull04
2 Replies

10. IP Networking

Packet going out of wrong interface due to OS automatically added cache route with lower metric

RHEL 7.0, IPV6 Scenario: I have routed specific network using network scripts. 1. "ip -6 route show" shows that route has been added. ( with metric 1024) 2. Ping of the specific IP through that route is successful. 3. Now after few days, for some reason, we see that cache route appears for... (3 Replies)
Discussion started by: msr1981
3 Replies
IPX_INTERFACE(8)					      System Manager's Manual						  IPX_INTERFACE(8)

NAME
ipx_interface - add, delete, or display an IPX interface SYNOPSIS
ipx_interface add [-p] device frame_type [network number[:node number]] ipx_interface del device frame_type ipx_interface delall ipx_interface check device frame_type ipx_interface help DESCRIPTION
ipx_interface adds, deletes, or displays IPX interfaces depending on the option selected. An IPX interface is the item to which IPX sockets are bound. An IPX interface corresponds to an IPX Network Number which corresponds to a physical device and frame type. A sample IPX Interface would be: Network Number: 0x00ABCDEF Device: Eth0 Frame Type: 802.2. There is a special IPX interface per host known as the PRIMARY or default interface. You should specify node number only if you really know, what you are doing - on point-to-point devices, on loopback and on tap device if you are running Compatibility mode driver. OPTIONS add This option is used to create an IPX interface. If the -p flag is used, the interface is made PRIMARY. The network number can be optionally assigned. If it is not assigned, it is set to 0 which indicates it should be detected from the traffic on the network. del This option is used to delete an IPX interface. delall This option is used to delete all IPX interfaces. check This option is used to display the device, frame type, and network number of an IPX interface. help This option displays information about the utility. FILES
/proc/net/ipx_interface /proc/net/ipx_route BUGS
This functionality really belongs in ifconfig(8). AUTHOR
Greg Page <greg.page@caldera.com> Caldera, Inc. IPX Utilities IPX_INTERFACE(8)
All times are GMT -4. The time now is 04:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy