Sponsored Content
Special Forums IP Networking Selecting Interface based on Destination IP address Post 302337104 by DukeNuke2 on Thursday 23rd of July 2009 11:12:48 AM
Old 07-23-2009
for this the "defaultrouter" or "defaultgateway" setting is used... if you ping an address in your lan, the interface in your lan will be used. if you use a internet ip (and the defautroute points to your router) the other interface will be used...

have a look here:
http://en.wikipedia.org/wiki/Routing
 

10 More Discussions You Might Find Interesting

1. IP Networking

Obtaining IP address from both my network interface

HI folks, I am developing a software which one of the module is to interchange the ip address of another active network interface's when making a socket connection. I would like to know whether there is any function call that would enable me to retrieve the ip address that is obtained by a... (2 Replies)
Discussion started by: citiz3n
2 Replies

2. IP Networking

Selecting interface based on source and destination ip address

Hi all, I have some doubts in selecting the interface to transfer packets and receive the packets. --> Multiple interfaces : -------------------- 1) 0.0.0.0 --------> wild card address. 2) x.x.x.x --------> valid address.(192.168.1.156) 3) ff.ff.ff.ff -------->... (0 Replies)
Discussion started by: vijaypdp2006
0 Replies

3. Shell Programming and Scripting

Selecting A Section of A File Based On the Time Within It

Hi, I have a file formated like this: John 7.22 2010-01-25_17:01:36 George 8.22 2010-01-25_17:02:36 Bob 9.62 2010-01-25_17:04:36 Jane 10.11 2010-01-25_17:05:36 Emma 4.52 2010-01-25_17:01:36 What I want to do is cut out only the entries that have... (2 Replies)
Discussion started by: Donkey25
2 Replies

4. SCO

Change SCO - GUI or Desktop interface to DOS based interface

Hi all I have installed a demo version of SCO OpenServer 5.0.2, I finally found it is Desktop Interface, I would like to know how to change its interface to dos based interface? If you have any ideas, please tell me then. Thank you (2 Replies)
Discussion started by: TinhNhi
2 Replies

5. Shell Programming and Scripting

Selecting rows based on values in columns

Hi My pipe delimited .txt file contains rows with 10 columns. Can anyone advise how I output to file only those rows with the letters ‘ci' as the first 2 characters in the 3rd column ? Many thanks (4 Replies)
Discussion started by: malts18
4 Replies

6. Shell Programming and Scripting

Move all files from source to destination directory based on the filename

Move all files starting with a specific name to different directory. This shell script program should have three parameters File Name Source Directory Destination Directory User should be able to enter ‘AB_CD*' in file name parameter. In this case all the files starting with AB_CD will... (1 Reply)
Discussion started by: chetancrsp18
1 Replies

7. Shell Programming and Scripting

Selecting sequences based on scores

I have two files with thousands of sequences of different lengths. infile1 contains the actual sequences and infile2 the scores for each A, T, G and C in infile1. Something like this: infile1: >HZVJKYI01ECH5R TTGATGTGCCAGCTGCCGTTGGTGTGCCAA >HZVJKYI01AQWJ8 GGATATGATGATGAACTGGTTTGGCACACC... (4 Replies)
Discussion started by: Xterra
4 Replies

8. Solaris

How to set gateway address to a particular interface?

How to set gateway address to a particular interface? waht are the files need to update to make it permanent? (2 Replies)
Discussion started by: Naveen.6025
2 Replies

9. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

10. UNIX for Beginners Questions & Answers

Selecting lines based on the value in the 3rd column.

Hello, I have a sample data like this: A1 B1 100.00 B1 A1 100.00 A2 B2 90.80 B2 A2 90.80 A3 B3 99.07 B3 A3 99.07 A4 B4 99.00 B4 A4 99.00 A5 B5 97.13 B5 A5 99.53 . . Ax By i By Ax j each two lines are same comparison with opposite order. What I expected is... (3 Replies)
Discussion started by: nengcheng
3 Replies
GETIFADDRS(3)						   BSD Library Functions Manual 					     GETIFADDRS(3)

NAME
getifaddrs -- get interface addresses SYNOPSIS
#include <sys/types.h> #include <sys/socket.h> #include <ifaddrs.h> int getifaddrs(struct ifaddrs **ifap); void freeifaddrs(struct ifaddrs *ifp); DESCRIPTION
The getifaddrs() function stores a reference to a linked list of the network interfaces on the local machine in the memory referenced by ifap. The list consists of ifaddrs structures, as defined in the include file <ifaddrs.h>. The ifaddrs structure contains at least the fol- lowing entries: struct ifaddrs *ifa_next; /* Pointer to next struct */ char *ifa_name; /* Interface name */ u_int ifa_flags; /* Interface flags */ struct sockaddr *ifa_addr; /* Interface address */ struct sockaddr *ifa_netmask; /* Interface netmask */ struct sockaddr *ifa_broadaddr; /* Interface broadcast address */ struct sockaddr *ifa_dstaddr; /* P2P interface destination */ void *ifa_data; /* Address specific data */ The ifa_next field contains a pointer to the next structure on the list. This field is NULL in last structure on the list. The ifa_name field contains the interface name. The ifa_flags field contains the interface flags, as set by ifconfig(8) utility. The ifa_addr field references either the address of the interface or the link level address of the interface, if one exists, otherwise it is NULL. (The sa_family field of the ifa_addr field should be consulted to determine the format of the ifa_addr address.) The ifa_netmask field references the netmask associated with ifa_addr, if one is set, otherwise it is NULL. The ifa_broadaddr field, which should only be referenced for non-P2P interfaces, references the broadcast address associated with ifa_addr, if one exists, otherwise it is NULL. The ifa_dstaddr field references the destination address on a P2P interface, if one exists, otherwise it is NULL. The ifa_data field references address family specific data. For AF_LINK addresses it contains a pointer to the struct if_data (as defined in include file <net/if.h>) which contains various interface attributes and statistics. For all other address families, it is NULL. The data returned by getifaddrs() is dynamically allocated and should be freed using freeifaddrs() when no longer needed. RETURN VALUES
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error. ERRORS
The getifaddrs() may fail and set errno for any of the errors specified for the library routines ioctl(2), socket(2), malloc(3) or sysctl(3). SEE ALSO
ioctl(2), socket(2), sysctl(3), networking(4), ifconfig(8) HISTORY
The getifaddrs implementation first appeared in BSD/OS. BUGS
If both <net/if.h> and <ifaddrs.h> are being included, <net/if.h> must be included before <ifaddrs.h>. BSD
April 21, 2009 BSD
All times are GMT -4. The time now is 12:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy