Wednesday, January 03, 2007

Basic Networking Commands you should know!

This would be mostly (*)nix based command set - Here we go...

  1. ping {hostname}
    Lets you check whether your internet connection is alive or lost
    Example : ping techflock.blogspot.com

  2. traceroute {hostname}
    Lets you trace packets and find if your connection is broken beyond your ip address. Also can be used to track the number of hops to get to the hostname
    Example: traceroute techflock.blogspot.com

  3. ifconfig
    Find out your ip address, your network interfaces, transferred and received data information
    Example : ifconfig

  4. nslookup {hostname}
    Find out the dns name resolves to a IP - a way to test your dns server
    Example: nslookup techflock.blogspot.com

  5. dig {hostname}
    Does the same as above and provides other dns related information
    Example: dig techflock.blogspot.com

  6. netstat -a
    Find out all the open ports on your machine
    Example: netstat -a

  7. netstat -nt
    Display all the tcp based established connections on your machine
    Example: netstat -nt

  8. telnet {hostname} {port}
    Telnet or connect to a machine at the specified port to find out whether that machine/server is working right
    Example: telnet techflock.blogspot.com 80

Ofcourse, there are many other options within each of these commands which you can find out through the manual pages by typing man {command}

Update:
Some of the commands might be in /sbin or /usr/sbin paths and might not be in default PATH. So go and execute it from there! For Example: /sbin/ifconfig

57 comments:

Anonymous said...

I believe it is ipconfig not ifconfig.

Roshan said...

Anonymous:

It is ifconfig in Linux based distributions (or GNU/Linux) and ipconfig in Windows.

Check out more here:
http://www.oreillynet.com/linux/cmd/cmd.csp?path=i/ifconfig

Clint said...

tracert, player. not traceroute.

Clint said...

ah... linux. sorry about that. I'm stuck in a windows environment

Anonymous said...

nslookup is a depreciated tool....

people should be using host or dig

Anonymous said...

I think ssh is the new version of telnet...

Shadowsun said...

What? No mention of netcat? It's absolutely invaluable!

Anonymous said...

do people still use telnet? isn't it insecure and all that. SSH wud be a better option IMHO

Ludo said...

For networking testing, you use telnet not ssh. For actually connecting to your pc from a remote location, you should indeed use ssh instead of telnet.
But say you're configuring an smtp or imap daemon. In that case, you use telnet to connect to it, and see what's wrong with it.

Anonymous said...

In OS X, ifconfig works like it does in linux. ipconfig is also there, which lets you see the ip status, such as dhcp, bootp, maunal etc, and lets you set such automatic ip resolution.

Aggress said...

wget nmap ftp

bleh

Stan said...

Do these commands NOW while the connection is up - especially tracert (windows) traceroute (Linux) -
Record the results somewhere.

Then when the connection is actually down - you can compare the results.

Carlos said...

you forgot route...

Anonymous said...

netstat -ap also might be useful, to obtain the pid of the program which is listening on specific ports

zemote said...

Yes ssh should be used for accessing another machine remoteley and not telnet, but telnet is a still a hugely useful command for extrapalating information from any remote port to see what service is running on any port.

blblack said...

"nslookup is a depreciated tool"

That word doesn't mean what you think it does. The word you're looking for is "deprecated".

Anonymous said...

The commenters are pretty cocky for not knowing jackshit. Jeebus.

Anonymous said...

i agree with anonymous
the ppl posting need to read a few books before enlightening us

John said...

yea all the windows trolls need to chill out, it's not ipconfig, and it's not tracert... what a bunch of dicks! if you don't know what you're talking about, just calm down and go somewhere else guys.

Anonymous said...

It's interesting that the windows based commenters are actually trying to be helpful and John (who presumably is not) is the only one actually being rude and in most definitions a troll.

Of course now I'm doing the worst thing possible in responding to the troll.

Anonymous said...

jeebus
;]

Anonymous said...

What? No lsof?

lsof -i

is the most useful command... it lists what services are using what ports. Remove the -i and it shows all the files open on the computer.

EnlightenmentThroughSarcasm said...

The Windows commenters (ipconfig, tracert) may have honestly intended to be helpful but nevertheless have merely shown their ignorance.

But perhaps, this is helpful too, in that it highlights what may be a confusing subject for many people--at least for those stupid Windows losers...

Anonymous said...

Also:
1. route
2. nmap
3. lsof
4. iwtools (iwconfig, etc)

Yvo said...

For those Windows folk that say tracert instead of traceroute, lets not forget that it was derived from traceroute but it *HAD* to be called tracert because of the 8 character limit imposed in MS-DOS (ref: http://www.answers.com/topic/traceroute-program)

Also ipconfig just handles IP configuration, whereas ifconfig (short for interface) does more then just IP configuration as it configures the entire interface for the machine (usually handled in Windows' drivers settings).

Lastly, telnet is *great* to test out if a port is up like the article (read guys) says, not to remote connect. Want to see if you can get to port 80 on a host (maybe the firewall is blocking it) or port blah blah (say you can't get to your mail server, do telnet mail.yourisp.com 110 for pop3 or smtp.yourisp.com 25 for smtp).

Please I know windows users are trying to help but it really does look uninformed and dumb when you correct the article by saying "tracert not traceroute" since the article specifies LINUX / UNIX commands.

Anonymous said...

In looking at the commands listed it looks like theyre mainly used for DNS lookups and to check that connectivity FROM the host is up, thats probably why things like netcat and lsof arent listed. Also I dont really think that its appropriate to say that if you're testing vs working use telnet over ssh. You can use ssh all you want and fail miserably if the far end isnt set to respond to ssh requests. Maybe you should try and take whats listed in context rather than starting a "OMFG u use telnet over SSH?!?!?!?! n00b"

pseudonym said...

To the guy who said:

I believe it is ipconfig not ifconfig.



HAHAHAHAHAHHAHAHAHAHAHAHAHAHAH mmwwwwaaHAHAHAHAHAHAHHAHAHAHAHAHAHHAHAHAHAHAHAH

usualbread said...

arp -a can be nice at times

Clint Laskowski, CISSP said...

Hey, Clint, is that you?

How about 'lynx' (see http://en.wikipedia.org/wiki/Lynx_%28web_browser%29)

:-)

-- Clint

Chas said...

mtr is another good tool. It is a cross between ping and traceroute.

Anonymous said...

I definately agree with anonymous

Anonymous said...

Networking can be said to be "vodoo science"
www.glendalegolfs.com

Anonymous said...

hum and what about the ip command and the netcat command.
And the telnet is deprecated as well, use ssh.

You should mention the nmap and tcpdump.

Anonymous said...

Regarding netstat and several more options that are useful and one mod to the oen you gave:

netstat -ltnp

will give you the actual processes locally holding open ports.

Also, when running netstat -a (open ports) or netstat -r (list routes) its good to add an 'n' e.g., netstat -rn , the benefit being it tells netstat *not* to do a DNS lookup on every IP address it handles. If you are having network issues, you probably have issues connectiong to your DNS server, which will cause the whole thing to hang(for short periods or forever).

Also, all the "windows corrections" just killed me =)

Anonymous said...

traceroute
dig
wget
nmap
netcat
ifconfig
netstat
iptables -- KNOW IT LIVE IT LOVE IT
route
expect -- networking-based scripting in tcl
ethereal

and last but not least:
ping. ok, it's the least.

drew said...

im in ur networks stealin your password since your so dumb you used telnet even though when you checking a service you won't get a password prompt

Anonymous said...

article should have specified which OS the commands work on, otherwise a good article

Anonymous said...

calm down people :) its just a blog, its all about helping and what OS you use doesnt really matter. learning all OSs is ideal any way.

Anonymous said...

You should also know:
your ass
a hole in the ground
If you don't know "ping", then you are retarded.

Anonymous said...

Telnet rulez.

I use telnet on all of my ultra secure government and corporate machines.

Cryptography and ssh are obsolete.

Make sure that the most encryption you ever uze is rot13 or a xor mask.

-Dogno7

Anonymous said...

about ifup

Anonymous said...

*how about ifup and ifdown

Anonymous said...

"article should have specified which OS the commands work on, otherwise a good article"
-----------------------------------------

These commands work with the majority of todays operating systems i.e. OSX, Linux, BSD, Solaris, AIX, HPUX etc. etc.

The only major OS that does these things differently is..... go on, guess.

Anonymous said...

should have been...

"The only major OS that does these things differently or not at all is...."

Anonymous said...

add arp -a
to that list

Anonymous said...

Telnet is still pretty handy. You can telent to different ports to test if you can make a TCP connection between your hosts. For example, telnet to port 80 to connect to a webserver.

Tim Archer said...

I have a little writeup on how to use the dig command to lookup DNS information. You can read it at http://timarcher.com/?q=node/38

Tim

syed said...

i want to know more comments in networking.now i am working with exchange server 2003.

Paramjit said...

Its really nice to have discussion with you guys.Thanx......

Anonymous said...

drew... just lol at that statement.

Also yes, telnet is FAR more unsecure. It does have encryption or anything.

there's brute forcers out there. I can connect all the time to remote telnet servers and all they ask for is a password. imho, very unsecure. SSH for the win.

Anonymous said...

This comment thread is hilarious.

Anonymous said...

its not ifconfig. it is ipconfig

Anonymous said...

hi

yatin said...

that was very good experience to read that lines.

Jay said...

What is ipconfig?

Anonymous said...

i didn't expect this kind of knowledge at one page , hope to see more.

Kmaran Khan said...

Very Helpful for beginners of networking.....