Sponsored Content
Top Forums UNIX for Advanced & Expert Users 'ifconfig' to skip loopback IPs Post 302404092 by ak835 on Monday 15th of March 2010 01:57:22 PM
Old 03-15-2010
Bug 'ifconfig' to skip loopback IPs

I generally use
Code:
/usr/sbin/ifconfig -a | grep "inet" |egrep -v "inet6|0.0.0.0|192.168.100.2"|awk '{print $2}'

to capture IPs on a host.

Now here is what i have:

Code:
bash-2.05$  /usr/sbin/ifconfig -a
lo0: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask ff000000
lo0:1: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask ff000000
lo0:2: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:3: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:4: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:5: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:6: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:7: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
lo0:8: flags=1000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4> mtu 8232 index 1
        inet <IP> netmask fffffff8
ce0: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 2
        inet <IP> netmask ffffff80 broadcast <BROADCAST>
        groupname ipmp
ce0:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2
        inet <IP> netmask ffffff80 broadcast <BROADCAST>
ce1: flags=9040843<UP,BROADCAST,RUNNING,MULTICAST,DEPRECATED,IPv4,NOFAILOVER> mtu 1500 index 3
        inet <IP> netmask ffffff80 broadcast <BROADCAST>
        groupname ipmp
ce1:1: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 3
        inet <IP> netmask ffffff80 broadcast <BROADCAST>
ce5: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 4
        inet <IP> netmask fffffc00 broadcast <BROADCAST>

As you can see,i have multiple loopbacks configured.I wish not to capture these IP addresses.I just want it to capture IP address which are not loopback i.e in above example..IPs for 'ceo'...etc...

Kindly advice

Abhi

Last edited by ak835; 03-19-2010 at 10:24 AM.. Reason: code tags, please...
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Loopback Interface...Vanished???

Recently I noticed that my internet connection would not work correctly-although connected domain names could not be resolved. My resolv.conf file was fine since it is configured every time I dial up. a closer inspection showed that my loopback interface had disappearerd! Any ideas why would this... (1 Reply)
Discussion started by: silvaman
1 Replies

2. Filesystems, Disks and Memory

Using loopback devices in RAID?

Hopefully I am posting this silly question in the right place... I was wondering about the possibility of using loopback files on a physical disk to create virtual disks that could shrink or grow as needed. Something like RAID 0, but instead of using block devices, just using files. If I need... (0 Replies)
Discussion started by: deckard
0 Replies

3. Filesystems, Disks and Memory

Can I Use Loopback Devices with LVM?

I've got a RedHat 9 box with LVM support in a 2.4.22 kernel. What I would like to do is take a set of empty files created with 'dd' and concatenate them into a volume group. I've done a good deal of googling, and it seems that this is something that can be done. But when I try to use 'pvcreate'... (3 Replies)
Discussion started by: deckard
3 Replies

4. AIX

loopback in 4.1.4.0 AIX server

Hi: I´ve a problem in a 4.1.4.0 AIX server because is generating a loopback in its own ip address and this are consuming all the bandwidth. I did many things trying to solve the problem but it doesn´t help. 1. Flush Routing tables 2. Get Up/Down Network interface 3. Add/remove Network... (0 Replies)
Discussion started by: terron79
0 Replies

5. Filesystems, Disks and Memory

Can a Loopback Filesystem be Partitioned?

I have a disk image file created for use with the Linux version of the QEMU emulator. It's partitioned. I opened it with fdisk and the partitions show up with some extra messages about physical/logical endings: Disk knoppix.img: 0 MB, 0 bytes 16 heads, 63 sectors/track, 0 cylinders Units =... (3 Replies)
Discussion started by: deckard
3 Replies

6. Solaris

Adding Loopback Interface

Hello, I have a SunOS (5.5.1) system that I need to migrate to a new IP address. I would like to have any requests destined for the old IP to be forwarded to this server. One suggestion I had was to add a route on my router that would point the old IP to the new IP. How do I add another... (2 Replies)
Discussion started by: reiklen
2 Replies

7. Linux

Loopback interface doen't appear

Hi all, i have a problem with (Network in Linux) .. my issue with a HW appliance has openfiler 2.3 and is used for File Sharing using samba .. the problem is when i try to list all configured network interfaces using ifconfig -a .. i can't see the loopback interface, Although the file... (3 Replies)
Discussion started by: mabdelmageid
3 Replies

8. UNIX for Dummies Questions & Answers

How to Loopback?

This is in the beginning of the program: clear tput cup 1 20 echo "Welcome to UNIX I Final Assignment" tput cup 4 3 echo -e "Who would you like to look up? \c" tput cup 6 5 echo "vans, Rolland" tput cup 8 5 echo "ones, Mildred" tput cup 10 5 echo "mith, Julie" tput cup 12 5 echo... (0 Replies)
Discussion started by: thriveforana
0 Replies

9. UNIX Desktop Questions & Answers

Loopback

clear echo "vans, Rolland" echo "Press in Your Keyboard to Quit" echo -e "Please Enter Your Choice : \c" read option case $option in I have created the corresponding information for each input on the display so... My question is... How do I display the corresponding information... (6 Replies)
Discussion started by: thriveforana
6 Replies

10. Red Hat

NAT Loopback and iptables

Hello, please can you help and explain me. I have two servers. Both are RHEL6. I use the first one like router and the second one for apache. Router forwards 80 port on the second server and I can open that from the internet (mysite.com, for example). But I can not open mysite.com if i try to... (0 Replies)
Discussion started by: 6765656755
0 Replies
iptunnel(8)						      System Manager's Manual						       iptunnel(8)

NAME
iptunnel - Creates, deletes, and displays configured tunnels SYNOPSIS
/usr/sbin/iptunnel [operation] [args] DESCRIPTION
The iptunnel command creates configured tunnels for sending and receiving IPV6 or IPV4 packets that are encapsulated as the payload of an IPV4 datagram. The iptunnel command can perform one of the following operations: Creates a tunnel interface, which you must subsequently configure by using the ifconfig command. The syntax of the create operation is as follows: iptunnel create [-I int-name] [v4-dest] [v4-src] Specifies the interface unit of the tunnel to be created. This is an optional parameter. The int-name parameter has the following form: iptx, where x is the interface unit number. By default, the interface name selected for the tunnel is iptx+1, or the value of the interface unit number of the last tunnel created plus 1. Specifies the remote end-point to which a tunnel is to be created. Sets the IPV4 source address in the encapsulating header. The tunnel is enabled (packets are sent/received on the tunnel) only if v4-src is a valid address on the system. This is an optional parameter. Deletes a tunnel interface. You must disable the tunnel before you can delete it by executing the following command: # ifconfig tunnel name down delete abort Shows the tunnel attributes (name, tunnel end points, next hop for tunneled packets). EXAMPLES
To create a tunnel from hobbes to calvin, enter: # iptunnel create -I ipt5 calvin ipt5 iftype 208 src 16.140.16.86 dst 16.140.16.91 To display the tunnel attributes, enter: # iptunnel show ipt5 interface ipt5 src 16.140.16.86 dst 16.140.16.91 gate 16.140.16.86 To config- uring the tunnel to encapsulate IPv6 packets, enter: # ifconfig ipt5 ipv6 up IPv6 packets will be sent as payloads of IPv4 datagrams from 16.140.16.86 to 16.140.16.91. The tunnel may also be used to send IPV4 packets encapsulated within IPV4 headers as follows: # ifconfig ipt5 10.10.80.60 netmask 255.255.255.0 To verify the previous command, enter: # ifconfig ipt5 ipt5: flags=4c1<UP,RUNNING,NOARP,MULTICAST> 16.140.16.86 --> 16.140.16.91 rxmt 1000, reach time 30000, dad tries 1, mtu 1280, hops 64, token len 64 inet 10.10.80.60 netmask ffffff00 ipmtu 1280 inet6 fe80::108c:1056 To deleting the tunnel, enter: # ifconfig ipt5 down delete abort ipt5: delete inet address 10.10.80.60 10.10.80.60: aborting 0 tcp connection(s) Then, enter: # iptunnel delete ipt5 interface ipt5 deleted SEE ALSO
Commands: ifconfig(8). RFC 2003, IP Encapsulation within IP, Perkins, C., October 1996 iptunnel(8)
All times are GMT -4. The time now is 10:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy