Sponsored Content
Top Forums Shell Programming and Scripting Get Local IP address using Sed, Awk Post 302526311 by kumaran_5555 on Tuesday 31st of May 2011 06:20:59 AM
Old 05-31-2011
Code:
 /sbin/ifconfig -a|awk '{if($1=="hme0:"){interface=1} if(interface==1 && $1=="inet"){print $2}}'

you have to change hme0 to e1000g0. The logic you have used may not work when you have more interface with broadcast enabled.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I get the IP address of my local unix box???

Hiya all, How do I get the IP address of my local unix box??? IPconfig - don't exist nslookup - only for other boxes.... I have my Fedora Server now on the office network. Can ping others, can get onto internet via web proxy.... Also: How do I create a Drive Share, so our windows... (9 Replies)
Discussion started by: marty 600
9 Replies

2. Shell Programming and Scripting

Easy way to get local IP address

I needed to get a machine's local IP address when not root (so no ifconfig). Eventually, I arrived at this convoluted solution that grabs the unique local IP info from netstat... netstat -n -t | awk '{print $4}' | grep -o "*\.*\.*\.*" |\ grep -v "127.0.0.1" | sort -u ...however I... (5 Replies)
Discussion started by: simonb
5 Replies

3. Shell Programming and Scripting

Local system IP address in UNIX

We have requirement to get the local system IP address of whoever logined the DataBase(sqlplus) or any process in application server. Actually I connected to application server thru putty and then conencted to Database using sqlplus command. we have tried below commands : who -u|grep... (4 Replies)
Discussion started by: siri_886
4 Replies

4. BSD

Link Local IPv6 Address

Hi, Am using FreeBSD7.4/i386 During IPv6 configuration, I added the following in rc.conf as Restarted IPv6 network using /etc/rc.d/network_ipv6 restart.. My problem is I need to set link local IPv6 address auto-configured.. Is my proceeding right?? I feel something missing to make... (0 Replies)
Discussion started by: Priya Amaresh
0 Replies

5. IP Networking

How to know local IP address in X-Terminal?

Im using a X-Terminal in my windows pc to connect to a Linux server. Is there a way to know my local IP address in my x-terminal console? Here are few commands which didnt help me: ss_cc@MGTS5026-13sh1:~> finger Login Name Tty Idle Login Time Where loadhlr ... (6 Replies)
Discussion started by: Arun_Linux
6 Replies

6. Shell Programming and Scripting

HELP with awk or sed. Need to replace all IP address by 2

Hi, In a file, I have several time <IP>232.0.1.164</IP> ... <IP>232.0.1.135</IP> I need to replace all the random IP addresses , by 239.0.0.1 and 239.0.0.2 , alternatively. I try this grep "<IP>" tsp.xml | awk '{if(NR % 2)print $0}' | cut -d"<" -f2 | cut -d">" -f2 ... (3 Replies)
Discussion started by: FredMo
3 Replies

7. Debian

How to change local IP address?

I have a new Ethernet device that has a default IP address on a different subnet and need to change it. I have a Debian 6.0 host connected to the device with a crossover cable and have changed the host /etc/hosts and /etc/networks files to the same subnet as the new device and rebooted. Ping... (2 Replies)
Discussion started by: snorkack59
2 Replies

8. Shell Programming and Scripting

IP Address Modification through awk/sed

Hi, I have to modify the 2nd and 3rd octet of the IP address through awk/sed. For Example: Given IP is : 10.205.22.254, it should be modified as 10.105.100.254 through awk/sed. Kindly help me on this and let me know if you have any questions. Thanks in advances. (2 Replies)
Discussion started by: kumarbka
2 Replies

9. IP Networking

netstat local and foreign address relationship.

Hi All, Can you please help me in understanding the relationship between local and foreign address in the output of netstat -an. Output 1 ---------- 162.103.162.37.50224 162.103.162.35.9511 49640 0 49640 0 ESTABLISHED 162.103.162.37.50263 162.103.162.35.9512 49640 0... (1 Reply)
Discussion started by: Girish19
1 Replies

10. IP Networking

Can't get local IP address in getaddrinfo

Hi all, I am working with SIP protocol and am using SIPp to generate SIP traffic. But the call is not going through since I get the error; 2015-02-24 14:09:39:330 1424804979.330517: Can't get local IP address in getaddrinfo, local_host='NODE-01', local_ip=''. My ifconfig output is; ... (2 Replies)
Discussion started by: Junaid Subhani
2 Replies
pppoec(1M)						  System Administration Commands						pppoec(1M)

NAME
pppoec - PPPoE chat utility SYNOPSIS
pppoec [-omillisecs] [-smillisecs] [-v] device [service [ [except]server... [only]]] pppoec [-omillisecs] [-v] -i [device] DESCRIPTION
The pppoec utility implements the client-side negotiation of PPPoE. It is intended to be used with the pppd(1M) connect option, in the same manner as the chat(1M) utility is used for asynchronous dial-up PPP. When given with the -i flag, pppoec sends out a broadcast query on the given interface named by the device parameter. You can specify no other arguments in this mode. All responding PPPoE servers and the offered services are displayed on standard output. Otherwise, when given without the -i flag, pppoec does the full PPPoE client-side negotiation. The device parameter is the intended Ether- net interface, and must already be plumbed with sppptun(1M). The optional service parameter specifies a particular service desired; other offered services will be ignored. The optional server parameter specifies a specific server desired. You can specify server as an Ethernet address in the usual x:x:x:x:x:x format (with "*" in any of the six byte positions interpreted to mean "any"), or as a symbolic name resolved through /etc/ethers (or NIS), or as a PPPoE access concentrator name. The sense of the match (true or false) can be inverted by specifying the keyword except before this string. This parameter can be specified more than once, and the first match is taken. If you specify the server parameter, then the selected servers become "preferred." If no preferred server responds, then the first respond- ing server is used instead. To exclude non-matching servers entirely, append the keyword only. OPTIONS
The following options are supported: -i Sends out broadcast query over interface specified by device. -o Sets the initial wait time in milliseconds for PADO from the server before PADI is retried. The default is 500 milliseconds for nor- mal operation, or 3000 milliseconds (3 seconds) for inquiry (-i) mode. -s Sets the initial wait time in milliseconds for PADS from the server before PADR is retried. The default is 2000 milliseconds (2 sec- onds). -v Displays verbose progress messages, including all PPPoE messages sent, and all state machine transitions. You normally do not need to adjust the parameters set with -o and -s. They are provided for coping with unusually slow servers. OPERANDS
The following operands are supported: device plumbed Ethernet interface server preferred server or, if you specify only, the specified server service desired service; other available services are ignored EXAMPLES
Example 1 Connecting to Any Service on hme0 The following command enables you to connect to any PPPoE service on hme0: # /usr/bin/pppd sppptun plugin pppoe.so connect "/usr/lib/inet/pppoec hme0" debug Often, a command such as the preceding is specified in an /etc/ppp/peers file instead. For example, enter the following in /etc/ppp/peers/myisp: sppptun plugin pppoe.so connect "/usr/lib/inet/pppoec hme0" debug To invoke the PPP connection described in the file, enter: % /usr/bin/pppd call myisp Note that, because the /etc/ppp/peers files are considered privileged by pppd, you need not be root to invoke the preceding command. Example 2 Connecting to a Particular Service A more complex example: on hme0, connect to only the internet service offered by PPPoE servers with access concentrator name isp, but not to any Ethernet addresses starting with 40:0:1a. # /usr/lib/inet/pppoec hme0 internet except 40:0:1a:*:*:* isp only Note that the except 40:0:1a:*:*:* filter must come before isp, because the filters are first-match. EXIT STATUS
The following exit values are returned: 0 Successful completion. >0 An error occurred. FILES
/usr/lib/inet/pppoec executable command /dev/sppptun Solaris PPP tunneling device driver. /etc/ppp/connect-errors usual location of error output (see DIAGNOSTICS, below) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWpppdt | +-----------------------------+-----------------------------+ SEE ALSO
pppd(1M), sppptun(1M), pppoed(1M), sppptun(7M) RFC 2516, Method for Transmitting PPP Over Ethernet (PPPoE), Mamakos et al, February 1999 DIAGNOSTICS
Error messages are written to standard error, which is normally redirected by pppd to /etc/ppp/connect-errors. The errors can also be redi- rected to pppd's standard output by using the updetach option. If you specify the -v, verbose progress messages are displayed, including all PPPoE messages sent, and all state machine transitions. Spec- ifying the updetach or nodetach pppd option is helpful when using verbose mode. SunOS 5.11 9 Jan 2002 pppoec(1M)
All times are GMT -4. The time now is 07:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy