Wednesday, July 30, 2008

Grab your IP

Often you need to know your IP, particularly when your are connected by DCHP kinda connection. So here are some handy tips :

CLI
  • Displaying the current config for all NIC's :
    $ ifconfig

  • Displaying the current config for a particular device :
    $ ifconfig device
    Example:
    $ ifconfig ppp0

  • For knowing your IP via which you are accessing WWW:
    $ ifconfig  | grep 'P-t-P' | cut -d: -f2 | awk {'print $1'}
    OR
    $ wget -q -O- http://www.whatismyip.com/automation/n09230945.asp
    Here we are taking the help of http://www.whatismyip.com/

  • Additional Jobs:

    Display the kernel’s IPv4 network neighbour cache:
    $ arp

    Display the kernel’s IP routing tables
    $ route

    Pinging:
    $ ping IP addr
    Example:
    $ ping 192.169.25.15


There are many more tools for advanced usage like nmap and others, but these are the basics.

SOURCE

No comments: