How to identify if an IP is aliased or not from ifconfig command ?

How to identify if an IP is aliased or not from ifconfig command ?

Post by Sundar Matpa » Thu, 26 Jun 2003 09:50:31



Hi :

I create an alias to en0 using ifconfig as follows :

#ifconfig en0 130.35.13x.xx netmask 255.255.252.0 alias

when I do ifconfig -a, I see both the IPs (the original one and the
alias)

en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 130.35.15x.xxx netmask 0xfffffc00 broadcast
130.35.15x.xxx
        inet 130.35.13x.xx netmask 0xfffffc00 broadcast 130.35.13x.xxx

How do I find out from ifconfig -a command that 130.35.13x.xx is an
alias ?

(Is it always the first IP in the ifconfig -a command for an interface
is the native IP and the rest following it aliases ?)

I am writing a shell script wherein given an IP, I should be able to
tell from ifconfig or netstat (whichever command) that it is an alias
or not ?

thanks,
sundar.

 
 
 

How to identify if an IP is aliased or not from ifconfig command ?

Post by Dunc » Fri, 27 Jun 2003 00:52:10



> Hi :

> I create an alias to en0 using ifconfig as follows :

> #ifconfig en0 130.35.13x.xx netmask 255.255.252.0 alias

> when I do ifconfig -a, I see both the IPs (the original one and the
> alias)

> en0: flags=e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
>         inet 130.35.15x.xxx netmask 0xfffffc00 broadcast
> 130.35.15x.xxx
>         inet 130.35.13x.xx netmask 0xfffffc00 broadcast 130.35.13x.xxx

> How do I find out from ifconfig -a command that 130.35.13x.xx is an
> alias ?

> (Is it always the first IP in the ifconfig -a command for an interface
> is the native IP and the rest following it aliases ?)

> I am writing a shell script wherein given an IP, I should be able to
> tell from ifconfig or netstat (whichever command) that it is an alias
> or not ?

> thanks,
> sundar.

Sundar,

lsattr -El en?

will give you the attributes of that interface

lsattr -El en? -a netaddr

will give you the address that is held in the ODM for that interface.
You can also get the alias details of the interface as well (-a alias4
or -a alias6) depending on what version of TCP your running.

hth
Duncan

 
 
 

How to identify if an IP is aliased or not from ifconfig command ?

Post by Sundar Matpa » Fri, 27 Jun 2003 08:14:14


Thanks Duncan. It gave me some pointers towards lsattr command.
But unfortunately in my AIX (5L), lsattr somehow is not showing up
alias4 with the address.

#ifconfig en0 130.35.137.53 netmask 255.255.252.0 alias

# lsattr -El en0 -a netaddr
netaddr 130.35.138.27 Internet Address True

# lsattr -El en0 -a alias4
alias4  N/A True      <<<< NO IP HERE ? Is it a bug ? >>>>

# lsattr -El en0
mtu           1500          Maximum IP Packet Size for This Device    
True
remmtu        576           Maximum IP Packet Size for REMOTE Networks
True
netaddr       130.35.138.27 Internet Address                          
True
state         up            Current Interface Status                  
True
arp           on            Address Resolution Protocol (ARP)        
True
netmask       255.255.252.0 Subnet Mask                              
True
security      none          Security Level                            
True
authority                   Authorized Users                          
True
broadcast                   Broadcast Address                        
True
netaddr6                    N/A                                      
True
alias6                      N/A                                      
True
prefixlen                   N/A                                      
True
alias4                      N/A                                      
True
rfc1323                     N/A                                      
True
tcp_nodelay                 N/A                                      
True
tcp_sendspace               N/A                                      
True
tcp_recvspace               N/A                                      
True
tcp_mssdflt                 N/A                                      
True

# ifconfig -a
en0: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
        inet 130.35.138.27 netmask 0xfffffc00 broadcast 130.35.139.255
        inet 130.35.137.53 netmask 0xfffffc00 broadcast 130.35.139.255
en2: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
        inet 192.186.20.1 netmask 0xfffffc00 broadcast 192.186.23.255
         tcp_sendspace 131072 tcp_recvspace 65536
en1: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
        inet 192.186.88.1 netmask 0xfffffc00 broadcast 192.186.91.255
lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
        inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
        inet6 ::1/0
         tcp_sendspace 65536 tcp_recvspace 65536

# ping 130.35.137.53
PING 130.35.137.53: (130.35.137.53): 56 data bytes
64 bytes from 130.35.137.53: icmp_seq=0 ttl=255 time=0 ms
64 bytes from 130.35.137.53: icmp_seq=1 ttl=255 time=0 ms
^C
----130.35.137.53 PING Statistics----
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max = 0/0/0 ms

 
 
 

How to identify if an IP is aliased or not from ifconfig command ?

Post by Dunc » Fri, 27 Jun 2003 17:59:19



> Thanks Duncan. It gave me some pointers towards lsattr command.
> But unfortunately in my AIX (5L), lsattr somehow is not showing up
> alias4 with the address.

> #ifconfig en0 130.35.137.53 netmask 255.255.252.0 alias

> # lsattr -El en0 -a netaddr
> netaddr 130.35.138.27 Internet Address True

> # lsattr -El en0 -a alias4
> alias4  N/A True      <<<< NO IP HERE ? Is it a bug ? >>>>

<snip> - see below

Quote:

> # ifconfig -a
> en0: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
>         inet 130.35.138.27 netmask 0xfffffc00 broadcast 130.35.139.255
>         inet 130.35.137.53 netmask 0xfffffc00 broadcast 130.35.139.255
> en2: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
>         inet 192.186.20.1 netmask 0xfffffc00 broadcast 192.186.23.255
>          tcp_sendspace 131072 tcp_recvspace 65536
> en1: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
>         inet 192.186.88.1 netmask 0xfffffc00 broadcast 192.186.91.255
> lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
>         inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
>         inet6 ::1/0
>          tcp_sendspace 65536 tcp_recvspace 65536

> # ping 130.35.137.53
> PING 130.35.137.53: (130.35.137.53): 56 data bytes
> 64 bytes from 130.35.137.53: icmp_seq=0 ttl=255 time=0 ms
> 64 bytes from 130.35.137.53: icmp_seq=1 ttl=255 time=0 ms
> ^C
> ----130.35.137.53 PING Statistics----
> 2 packets transmitted, 2 packets received, 0% packet loss
> round-trip min/avg/max = 0/0/0 ms

Sundar,

I checked with our AIX5.2 machines and AIX didnt show any addresses
under the alias? attribute either, so it isnt a bug.
The safest way is to check the ODM first, get the native address then
you know the others are alias addresses.

odmget -q "name=en? AND attribute=netaddr" CuAt

hth,
Duncan

 
 
 

How to identify if an IP is aliased or not from ifconfig command ?

Post by Sundar Matpa » Sat, 28 Jun 2003 01:12:57


Thanks Duncan. I wrote the script by getting the interface of an given
IP thru' netstat, and doing an lsattr -El INTERFACE -a netaddr on that
interface and get the true address. If it is not same as the given IP,
then it is an alias.

sundar.



> > Thanks Duncan. It gave me some pointers towards lsattr command.
> > But unfortunately in my AIX (5L), lsattr somehow is not showing up
> > alias4 with the address.

> > #ifconfig en0 130.35.137.53 netmask 255.255.252.0 alias

> > # lsattr -El en0 -a netaddr
> > netaddr 130.35.138.27 Internet Address True

> > # lsattr -El en0 -a alias4
> > alias4  N/A True      <<<< NO IP HERE ? Is it a bug ? >>>>

> <snip> - see below

> > # ifconfig -a
> > en0: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
> >         inet 130.35.138.27 netmask 0xfffffc00 broadcast 130.35.139.255
> >         inet 130.35.137.53 netmask 0xfffffc00 broadcast 130.35.139.255
> > en2: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
> >         inet 192.186.20.1 netmask 0xfffffc00 broadcast 192.186.23.255
> >          tcp_sendspace 131072 tcp_recvspace 65536
> > en1: flags=4e080863<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,PSEG>
> >         inet 192.186.88.1 netmask 0xfffffc00 broadcast 192.186.91.255
> > lo0: flags=e08084b<UP,BROADCAST,LOOPBACK,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT>
> >         inet 127.0.0.1 netmask 0xff000000 broadcast 127.255.255.255
> >         inet6 ::1/0
> >          tcp_sendspace 65536 tcp_recvspace 65536

> > # ping 130.35.137.53
> > PING 130.35.137.53: (130.35.137.53): 56 data bytes
> > 64 bytes from 130.35.137.53: icmp_seq=0 ttl=255 time=0 ms
> > 64 bytes from 130.35.137.53: icmp_seq=1 ttl=255 time=0 ms
> > ^C
> > ----130.35.137.53 PING Statistics----
> > 2 packets transmitted, 2 packets received, 0% packet loss
> > round-trip min/avg/max = 0/0/0 ms

> Sundar,

> I checked with our AIX5.2 machines and AIX didnt show any addresses
> under the alias? attribute either, so it isnt a bug.
> The safest way is to check the ODM first, get the native address then
> you know the others are alias addresses.

> odmget -q "name=en? AND attribute=netaddr" CuAt

> hth,
> Duncan

 
 
 

1. IP aliasing -ifconfig not working

folks:

I have compiled ip aliasing into my kernel (version 2.0.30), and
re-booted the kernel.

/proc/net/aliases and alias_types  'files' show up, with no entries

normal network ifc's (lo and eth0) are setup and fine.

/sbin/ifconfig eth0:0 <ip addr>  command gives:
SIOCSIFADDR: Invalid argument error

Consulted man pages, howto's etc, all claim the above ifconfig should
work.

What is wrong???

thanks..

r.

2. suwalskb@bellsouth.net

3. How to identify ,through which IP address i'am connected ?

4. HP-UX 11i V1.6 kernel debugging

5. ifconfig alias command

6. Process Signalling

7. ifconfig with alias command - Where?

8. Little endian PPC rebuild?

9. Script problem with ifconfig, to do IP aliasing.

10. TCP/IP aliases & ifconfig under Solaris

11. ?:Kernel V2.2.-IP Alias-eth0:0 Is Invisible To 'ifconfig"?

12. Need Multi-IP ifconfig alias patch

13. Smart ifconfig? (aliasing 2 IP's)