Wednesday, October 04, 2006

Linux Network Basic

Display all the interfaces you have on your server:

Display all interfaces as well as inactive interfaces you may have:
ifconfig -a

Assign the eth0 interface the IP-address with netmask
ifconfig eth0 netmask

Assign the default gateway for eth0 to (for example your router):
route add default gw eth0

Verify that you can reach your router (

Display the routing information with the command route to see if routing entry is correct:
route -n

Check the status of the interfaces quickly:
netstat -i

Show all active connections:

Show all active TCP connections:
netstat -t

DNS lookups (3 different ways) and displays the answers that are returned from the name server (To troubleshoot DNS problems):

Determine the network route from your computer to some other computer:

View your ARP (used by a networked machine to resolve the hardware location/address of another machine on the same local network) Cache:

Remove any entry from the ARP cache for the specified host (for example
arp -d

Check traffic in network :
tcpdump -n arp

Send out unsolicited ARP messages so as to update remote arp caches (for example

Shutdown a specific interface (for example eth0):
ifconfig eth0 down

Activate a specific interfrace (for example eth0):
ifconfig eth0 up

Stop all network devices manually on your system (Debian specific):
/etc/init.d/networking stop

Start all network devices manually on your system (Debian specific):
/etc/init.d/networking start

Restart all network devices manually on your system (Debian specific):
/etc/init.d/networking restart

Networking configuration is stored in the following file:

Ubuntu Linux Blog by Ralph


Kshitij said...

ifconfig eth0 netmask
this command is usually used with another parameter 'broadcast'. even this might be sufficient but the use that i've seen.

techlinux said...

hi ajit,

very good and very clear tutorial well done. keep posting some thing very basic and easy to grasp like this one. i have also started learing linux just a couple of weeks ago. looks nice. windows days are over now for me.

can you please help me???

i have two pcs both having fedora core 5 on them no windows. none of them is ever gonna be connected to the internet. so this is just a small home network. only the 2 pcs talking to each other only and i m gonna use a crossover cable to connect them no switch or router. no more pcs are gonna be added to this network as well.

the objectives:

1. i want one of them to be the server (pc 1) and other the client (pc 2).

2. the server should should hold the log in details of each user that uses the other client (pc 2). whenever a user using the client pc starts the machine he should be prompted to enter username and password. just like a pc on a network in any university or company these days.

3. i will design webpages in php-mysql and store them on server only (pc 1) and these web pages should be served to the client (pc 2) just like any body accessing bbc or yahoo sites. this is sort of intranet set up. if a webpage allows users to a file for example their cv from the client machine, they should be able to do so. i mean i want file upload facility.

4. users using the client machine (pc 2), irrespective of whatever they save or modify as their personal file/work should be saved on the server only. just like a student or employee making a file then saving it on uni/company server space only rather the machine's hard drive.

5. i want users on the client machine to be able to check their e-mails. like on windows machines people can send e-mail to each other within the company using outlook express. i do not know which software is used on linux pcs to do so. please let me know. please remember none of the two machines (server or clinet) are ever going to be connected to the ineternet.

6. what do i need in terms of hardware, what type of cables, switch or router? i have a switch lying unused that be of any use here.

i think in order to achieve the whole thing, i must use http, apache, ftp, ldap, nis etc. but do not know which one for what purpose in specific. i have mentioned as what i want above. please guide me to achieve this. i will do my best. thanks.