Latest Routing Interview Questions
1. What is Routing?
The ROUTING TABLE is a table maintained in the kernel that determines how packets are routed to other systems. A number of programs may add or delete routes from the routing tables, including route, ifconfig, in.routed and in.rdisc. The routing table consists of three types of routes: HOST ROUTES are checked first and define a route to just one host.
NETWORK ROUTES are checked second and define a route to all the hosts on one network. DEFAULT ROUTES are used as a catch-all, when no host or network routes are found to a destination. They usually send to a more knowledgeable routing machine, which has a better chance of being able to find a host or network route to the destination.
2. What is ARP?
ARP, the ADDRESS RESOLUTION PROTOCOL. ARP is the protocol which converts the IP address to an address appropriate to the hardware type (ie, Ethernet addresses on an ether network). After normal routing protocols have done their work, ARP springs in to action. It’s what actually gets packets from one machine to another. Usually, you should not have to worry about ARP at all. Except in special setups, it should work totally transparently.
3. How Routing Starts Up?
Solaris and SunOS each have a specific order which they use to start up routing: If an /etc/defaultrouter file exists, only static routing will be used, and a static default route will be created to the machine listed in the defaultrouter file. If there is no /etc/defaultrouter file, and the machine is a router, both in.routed and in.rdisc will be started, and they will advertise routing information. SunOS machines will only start up in.routed, as in.rdisc is not available under SunOS. If there is no /etc/defaultrouter file, and the machine is a host, in.rdisc is initially started.
If any machines on the same network advertise via Routing Discovery, in.rdisc will be used as the dynamic routing program if there are no machines advertising via Routing Discovery, in.rdisc will quickly quit. SunOS skips this step. Finally, if there is no /etc/defaultrouter file, and either the machine is running SunOS, or in.rdisc has failed, then in.routed is started. It will listen for other in.routed programs advertising via RIP packets. This is the default manner in which most out-of-the-box Suns will operate.
4. What is IP addresses, Netmasks and Subnets?
All IP ADDRESSES are divided into two portions: the NETWORK ADDRESS, and the HOST ADDRESS. The network portion of the IP address defines the level at which routing is done this means that all machines with the same network address are on the same network. For example, if we had the IP address a.b.c.d, we might learn that the network portion of that address was a.b, and the host portion of that address was c.d. In that case, all machines with the IP address a.b.*.* would be on the same network.
We would typically see a route to the network a.b.0.0. By default, Internet IP addresses are divided into 3 Classes. Each of these ranges has a different portion of the IP address reserved as the network and host addresses. Class IP Range Network Host
Class A 1.*.*.* to 127.*.*.* a b.c.d
Class B 128.*.*.* to 191.*.*.* a.b c.d
Class C 192.*.*.* to 223.*.*.* a.b.c d
Multicast: Class D 224.0.0.0 to 239.255.255.255.
Reserved: Class E 240.0.0.0 to 247.255.255.255
5. What is ifconfig?
It is always best to start investigating routing problems by making sure that your interfaces are set up correctly. By running ifconfig, you can see your current interface setup: # ifconfig -a lo0: flags=849 mtu 8232 inet 127.0.0.1 netmask ff000000 le0: flags=863 mtu 1500 inet 150.101.16.28 netmask ffffff00 broadcast 150.101.16.255 ether 8:0:20:10:78:d When an interface is brought up, it automatically creates a route.
This route will be to the local network for multipoint interfaces (ether, FDDI, TR, etc), or to a host for point-to-point interfaces (PPP). If your main interface (le0 in the above example) is not UP and RUNNING, clearly no routing will be occurring through it. If the interface is UP, you will also want to examine the inet and netmask entries of your main interface, and make sure they are set correctly. If the inet is set wrong, check your /etc/hostname.interfacename file (ie, hostname.le0) and your /etc/hosts file. If the netmask is set wrong, check your /etc/netmasks file
6. What is netstat?
You can examine your current routing tables by running the command netstat, as follows: %%%% netstat -rn
7. Explain ping?
If your problem is not obvious from examining ‘ifconfig -a’ and ‘netstat -rn’, the ping command can be very useful in diagnosing it further. Try running ‘ping -s machine-with-no-route’. There are two possibilities. If you get some type of ‘network unreachable’ or ‘host unreachable’ error, this typically means that there is no route on your machine to the machine you are trying to ping. You will probably need to define a static route for that machine’s network, or possibly a default route.
Following are a few examples. Under SunOS, you’ll just get the basic ‘… unreachable’ errors: %%%% ping -s lab-manta PING lab-manta: 56 data bytes sendto: Network is unreachable ping: wrote 150.101.89.28 64 chars, ret=-1 At this point, you should return to looking at your ‘netstat -r’ table.
8. What is traceroute?
If you can’t solve your routing problems by looking at the routing tables and interfaces, a useful program for helping solve the problem is traceroute. Solaris 2.7 software bundles the popular traceroute utility. Unfortunately, this program is not shipped with SunOS or Solaris prior to 2.7, and as a result is not supported by SunService. However, you can easily find a copy on the internet. The ftp site ftp.dfn.de contains traceroute under the /pub/tools directory. If you consult ‘archie’ or other searching programs, it is likely that you will be able to find a more local copy.
Traceroute works by sending out a set of 3 UDP packets. These packets are initially given a Time-To-Live of 1 hop, which is then increased to 2 hops, then to 3, etc…. until the packets reach the remote machine. This has the effect of stepping through the routers leading towards a destination machine, one at a time.
However, it also causes you to only see a unidirectional route, from your client to the destination machines. It’s quite possible for routes to be different going from and to a machine, and traceroute will not standardly show this. For example, if packets followed the following path: –> C –> A B ’ wc -l` And immediately after them, insert the following: numifs=2 numptptifs=0 After the machine next reboots, it will not act as a router. If you are using Solaris 2.5 or greater, it’s even easier to make your machine not route packets. Simply create an /etc/notrouter file: %% touch /etc/notrouter Afterwards, reboot the machine.
It may be useful to note, that on Solaris machines, ip_forwarding can have three values: 0 Never Forward 1 Always Forward 2 Only forward when two or more interfaces are up The above steps result in the ndd /dev/ip ip_forwarding variable being changed from “1” to “0”, which prevents routing.
16. How to Set a Netmask under SunOS?
In order to include a permanent netmask on your SunOS machine, you must make an entry in the /etc/netmasks file, in the following format: network-address-without-zeroes netmask For example: %%%% cat /etc/netmasks 150.101 255.255.255.0 The above would subnet the class B network, 150.101.0.0, into 254 subnets, from 150.101.1.0 to 150.101.254.0. It is important to note that the entry in the left hand column must be the original base network number (ie # for a Class A, #.# for a Class B and #.#.# for a Class C), not the subnet.
17. How to Set a Netmask under Solaris?
In order to include a permanent netmask on your Solaris machine, you must make an entry in the /etc/netmasks file, in the following format: network-address netmask For example: %%%% cat /etc/netmasks 150.101.0.0 255.255.255.0 The above would subnet the class B network, 150.101.0.0, into 254 subnets, from 150.101.1.0 to 150.101.254.0. In 2.5.1 and below, only one entry for the entire class network is allowed to support standard subnetting as specified in RFC-950 It is important to note that the entry in the left hand column must be the original base network number (ie #.0.0.0 for a Class A, #.#.0.0 for a Class B and #.#.#.0 for a Class C), not the subnet. The 2.6 kernel has changed to support VLSM.
It is now possible to combine the RFC-950 and RFC-1519 form of subnet masks in the netmasks file. The network address should be the “SUBNETTED” address NOT the standard network number based on the hosts ip address. (see man page for netmasks) Here are a few examples: A host address 192.188.206.65 with a netmask of 255.255.255.224 /etc/netmasks 192.188.206.64 255.255.255.224 A host address 172.31.16.193 with a netmask of 255.255.255.192 /etc/netmasks 172.31.16.192 255.255.255.192
18. How does /ip route check-gateway work?
check-gateway sends pings every 10 seconds. if two successive pings fail, the gateway is considered dead.
19. How to filter out the default route from outgoing BGP advertisements?
Assuming you have a static default route that is redistributed because redistribute-static parameter is set to yes, do the following:
/routing filter add chain=myfilter prefix=0.0.0.0/0 action=discard
Then set myfilter as the out-filter for BGP instance
/routing bgp instance set default out-filter=myfilter