Sponsored Content
Full Discussion: return IP address
Top Forums UNIX for Dummies Questions & Answers return IP address Post 302248926 by radoulov on Monday 20th of October 2008 06:40:37 AM
Old 10-20-2008
You may try Perl instead of the grep, grep, cut ... pipeline:

Code:
/sbin/ifconfig |
  perl -lne'print "_$1_$2"
    if /inet addr:192\.\d+\.(\d+)\.(\d+)/
    '

 

10 More Discussions You Might Find Interesting

1. IP Networking

pine username return address

hello all I am happily using pine but unhappily sending email as username@where.my.mail.works instead of ****@my.college.edu well, my username on my computer is one thing, but my username on my college account (**** here) is different. what I'm trying to do is use the college server for... (1 Reply)
Discussion started by: plusran
1 Replies

2. Programming

Return IP address

Not sure whether this is an appropriate request, however, Using C++ code I'm running a unix command from the pc that needs the IP address of the PC in order to set the DISPLAY variable. The code is written using Builder C++ (Borland) but I'm having difficulty finding what functions / header... (3 Replies)
Discussion started by: gefa
3 Replies

3. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

4. Shell Programming and Scripting

Read Hostname and Return IP Address

Dear Experts, I have a text file on my itanium box which contains list of nearly 1000 hostnames. I do not have the IP Address of them. I want read each entry from the text file and want to do a nslookup to the DNS Server and get the IP Adresses and put them in another file in the format... (1 Reply)
Discussion started by: PrasannaKS
1 Replies

5. UNIX for Dummies Questions & Answers

Panic kernal-mode address fault on user address 0x14

:) Firstly Hi all!!, im NEW!! and on here hoping that someone might be able to offer me some help... i have a server that keeps crashing every few days with the error message: PANIC KERNAL-MODE ADDRESS FAULT ON USER ADDRESS 0X14 KERNAL PAGE FAULT FROM (CS:EIP)=(100:EF71B5BD) EAX=EF822000... (10 Replies)
Discussion started by: Twix
10 Replies

6. Shell Programming and Scripting

Validate an IP address - Return to menu

hi! I need a script that, among other things, presents a menu to the user, checks the user input for an IP address (in quad dotted notation), and then "redirects" (with sed) that IP address to the Firewall script. The script must check that all of the inputs are valid IP addresses (numeric,... (1 Reply)
Discussion started by: zetetic
1 Replies

7. Shell Programming and Scripting

Need to get return code from mutt if an address is invalid/undeliverable from Unix shell script

I am using mutt on ksh Unix to send emails to addresses plucked from the database. If the "To:" email address is not longer valid and so the email is not sent to the "To:" recipient, but is sent to the valid cc address, I need to be able to get an error code returned to the shell script so that... (3 Replies)
Discussion started by: jzuber
3 Replies

8. IP Networking

Set default return address for all mails sent from mailx

Hi, I have a question about mailx in Red Hat: If I use 'mail userid@mydomain.com -- -f root@mydomain.com', the return mail address will be root@mydomain.com. How can I make all mails sent from this system use root@mydomain.com as return address by default? Thank you in advance! nz (1 Reply)
Discussion started by: aixlover
1 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. Shell Programming and Scripting

Return: can only `return' from a function or sourced script

Not sure where the problem is. I can run the script without any issue using the following command. . /opt/app/scripts/cdc_migration.sh But it fails with the below error when I try it this way /opt/app/scripts/cdc_migration.sh /opt/app/scripts/cdc_migration.sh: line 65: return: can only... (1 Reply)
Discussion started by: svajhala
1 Replies
IN_GETIFA(9)						   BSD Kernel Developer's Manual					      IN_GETIFA(9)

NAME
in_getifa -- Look up the IPv4 source address best matching an IPv4 destination SYNOPSIS
options IPSELSRC #include <netinet/in_selsrc.h> struct ifaddr * in_getifa(struct ifaddr *ifa, const struct sockaddr *dst0); DESCRIPTION
in_getifa enforces the IPv4 source-address selection policy. Add the source-address selection policy mechanism to your kernel with options IPSELSRC. options IPSELSRC lets the operator set the policy for choosing the source address of any socket bound to the ``wildcard'' address, INADDR_ANY. Note that the policy is applied after the kernel makes its forwarding decision, thereby choosing the output interface; in other words, this mechanism does not affect whether or not NetBSD is a ``strong ES''. An operator affects the source-address selection using sysctl(8) and ifconfig(8). Operators set policies with sysctl(8). Some policies con- sider the ``preference number'' of an address. An operator may set preference numbers for each address with ifconfig(8). A source-address policy is a priority-ordered list of source-address ranking functions. A ranking function maps its arguments, (source address, source index, source preference, destination address), to integers. The source index is the position of source address in the interface address list; the index of the first address is 0. The source preference is the preference number the operator assigned to source address. The destination address is the socket peer / packet destination. Presently, there are four ranking functions to choose from: index ranks by source index; lower indices are ranked more highly. preference ranks by source preference; higher preference numbers are ranked more highly. common-prefix-len ranks each source address by the length of the longest prefix it has in common with destination address; longer common prefixes rank more highly. same-category determines the "categories" of source and destination address. A category is one of private, link-local, or other. If the categories exactly match, same-category assigns a rank of 2. Some sources are ranked 1 by category: a link-local source with a private destination, a private source with a link-local destination, and a private source with an other des- tination rank 1. All other sources rank 0. Categories are defined as follows. private RFC1918 networks, 192.168/16, 172.16/12, and 10/8 link-local 169.254/16, 224/24 other all other networks---i.e., not private, not link-local To apply a policy, the kernel applies all ranking functions in the policy to every source address, producing a vector of ranks for each source. The kernel sorts the sources in descending, lexicographical order by their rank-vector, and chooses the highest-ranking (first) source. The kernel breaks ties by choosing the source with the least source index. The operator may set a policy on individual interfaces. The operator may also set a global policy that applies to all interfaces whose pol- icy he does not set individually. Here is the sysctl tree for the policy at system startup: net.inet.ip.selectsrc.default = index net.inet.ip.interfaces.ath0.selectsrc = net.inet.ip.interfaces.sip0.selectsrc = net.inet.ip.interfaces.sip1.selectsrc = net.inet.ip.interfaces.lo0.selectsrc = net.inet.ip.interfaces.pflog0.selectsrc = The policy on every interface is the ``empty'' policy, so the default policy applies. The default policy, index, is the ``historical'' pol- icy in NetBSD. The operator may override the default policy on ath0, # sysctl -w net.inet.ip.interfaces.ath0.selectsrc=same-category,common-prefix-len,preference yielding this policy: net.inet.ip.selectsrc.default = index net.inet.ip.interfaces.ath0.selectsrc = same-category,common-prefix-len,preference The operator may set a new default, # sysctl -w net.inet.ip.selectsrc.debug=> same-category,common-prefix-len,preference # sysctl -w net.inet.ip.interfaces.ath0.selectsrc= yielding this policy: net.inet.ip.selectsrc.default = same-category,common-prefix-len,preference net.inet.ip.interfaces.ath0.selectsrc = In a number of applications, the policy above will usually pick suitable source addresses if ath0 is configured in this way: # ifconfig ath0 inet 64.198.255.1/24 # ifconfig ath0 inet 10.0.0.1/24 # ifconfig ath0 inet 169.254.1.1/24 # ifconfig ath0 inet 192.168.49.1/24 preference 5 # ifconfig ath0 inet 192.168.37.1/24 preference 9 A sysctl, net.inet.ip.selectsrc.debug, turns on and off debug messages concerned with source selection. You may set it to 0 (no messages) or 1. SEE ALSO
ifconfig(8), sysctl(8) STANDARDS
The family of IPv6 source-address selection policies defined by RFC3484 resembles the family of IPv4 policies that in_getifa enforces. AUTHORS
David Young <dyoung@NetBSD.org> BUGS
With options IPSELSRC, a new interface ioctl(2), SIOCSIFADDRPREF, was introduced. It ought to be documented in inet(4). Also, options(4) ought to cross-reference this manual page. This work should be used to set IPv6 source-address selection policies, especially the family of policies defined by RFC3484. BSD
February 22, 2007 BSD
All times are GMT -4. The time now is 03:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy