Linux Routing table and Naming related commands

To check the routing table :
[root@apps /]# route 
[root@apps /]# route -n

To add a default route or gateway:
[root@apps /]# route add default gw

To delete a default gateway:
[root@apps /]# route del default

To add a route to a network
[root@apps /]# route add –net netmask dev eth0

To delete a  network from the routing table
root@apps /]# route del –net netmask dev eth0

To add a host route:
[root@apps /]# route add eth0

To delete a host route
[root@apps /]# route del

To trace the path / number of hops to a particular host on the network:
[root@apps /]# traceroute
[root@apps /]# traceroute

To do tracing of the route and ping at the same time, use mtr:
[root@apps /]# mtr

To find a host and/or it's IP on the network use the following commands. These will query your default DNS server of your network:
[root@apps /]# host
[root@apps /]# nslookup
[root@apps /]# dig

You can use hostname to get the FQDN of the a specific host. But remember that the FQDN hostname must be set in either /etc/sysconfig/network file or must be set manually using the hostname command. It is a good practice to write FQDN of each computer in it's own /etc/sysconfig/network  file. The checkis that the command hostname –-fqdn must return the FQDN of your machine. See below.

[root@apps /]# cat /etc/sysconfig/network
[root@apps /]# hostname
[root@apps /]# hostname --fqdn

In order to find out the name of your DNS domain, you should not use domainname command without arguments, as it will return you the name of the NIS domain, which in this case is not yet set. You can use -d switch with domainname command or use dnsdomainname command. The domainname -y also returns you the name of NIS domain (equal to ypdomainname command).

[root@apps /]# domainname
[root@apps /]# domainname -d
[root@apps /]# dnsdomainname
[root@apps /]# domainname -y
[root@apps /]# ypdomainname

To check the status of a wintendo machine on your network, use:
[root@apps /]# nmblookup -A
[root@apps /]# nmblookup -A

To check for the open ports on a machine on the network (may be the localhost itself):
[root@apps /]# nmap


Popular posts from this blog

How to create Oracle stored Procedures using TOAD for Oracle

How to Create Packages in Oracle Database using TOAD for Oracle

Create Tables in Oracle Database using TOAD