Sponsored Content
Full Discussion: UNIX Routing Tables
Top Forums UNIX for Dummies Questions & Answers UNIX Routing Tables Post 302960260 by ksmarine1980 on Thursday 12th of November 2015 11:19:46 PM
Old 11-13-2015
UNIX Routing Tables

I'm trying to learn the basic in's and out's of networking on my own through the use of a book. When it comes to routing tables I'm completely lost. I apologize for the alignment of the table below. The book vaguely explains routing tables, then has the following example:

Code:
E15.3) Consider the following netstat –rn output from a Linux system. Describe the routes and figure out the network setup. 
Which network 10.0.0.0 or 10.1.1.0, is closer to the Internet? Which process added each route? 

Destination	Gateway	    Genmask	   	Flags	  MMS	  Iface
10.0.0.0     	0.0.0.0	   255.255.255.0	U	  40 	           eth1
10.1.1.0     	0.0.0.0	   255.255.255.0	U	  40	           eth0
0.0.0.0	        10.0.0.1	     0.0.0.0			UG	  40             eth1

From my understanding, there are two networks - 10.0.0.0 & 10.1.1.0. Neither required a gateway, and are both listed as up (u) with a maximum segment size of 40. For packet(s) to leave the network and reach the internet they are passed to 0.0.0.0 to reach the 10.0.0.1 gateway. In terms of which is closer to the internet, I'd say that 10.0.0.0 is closer since it is also located on eth1, but I'm honestly not sure. In terms of which process is added to each route, that doesn't even make sense to me.

If anyone has any insight into routing tables and this example it would be greatly appreciated. Thank you!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Routing DSL to Unix from Windows

I'm brand new to this forum AND Unix. For obvious reasons. I don't know much at all. I'm 14 and i just got my first UNIX SPARCstation5 SUN computer. Something like that. i set up Solaris 9.1(With the help from my dad), now that i've gotten pertty much everything settled, i would like to route my... (8 Replies)
Discussion started by: SoulCheese
8 Replies

2. UNIX for Advanced & Expert Users

writing database tables into a file in unix

I want to collect the database tables(Ex: Emp,Sal,Bonus...etc) in a file & give this file at the command prompt, when prompted for the tables list at command prompt. How can i do that ? Ex:- Import jason/jason1 tables=emp,sal,bonus log=j1.log i want to change this into Ex:- Import... (3 Replies)
Discussion started by: dreams5617
3 Replies

3. IP Networking

any system call in unix to access ip routing table

hi is there any system call by which ip routing table can be accessed. (1 Reply)
Discussion started by: vinodkumar
1 Replies

4. UNIX for Dummies Questions & Answers

Routing tables

Hey guys, I needed to add a route to my routing table and I got it to work but on reboot it gets removed. Anyone know what file I can add this route to so it stays on the machine after a reboot? (9 Replies)
Discussion started by: kingdbag
9 Replies

5. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

6. UNIX for Dummies Questions & Answers

HELP me please. UNIX Routing

Hello everybody, I need help: I have to make routing between two different LAN. I have the IP for first network 81.180.75.70 and the mask is 255.255.255.192 and for the second network: 192.168.1.1 and the mask 255.255.255.0 So, each network has only one PC with windows (this is for test),... (0 Replies)
Discussion started by: meorfi
0 Replies

7. UNIX for Advanced & Expert Users

HELP me please. UNIX Routing

Hello everybody, I need help: I have to make routing between two different LAN. I have the IP for first network 81.180.75.70 and the mask is 255.255.255.192 and for the second network: 192.168.1.1 and the mask 255.255.255.0 So, each network has only one PC with windows (this is for test),... (11 Replies)
Discussion started by: meorfi
11 Replies

8. Shell Programming and Scripting

Howto compare the columns of 2 diff tables of 2 different schemas in UNIX shell script

HI All, I am new to Unix shell scripts.. Could you please post the unix shell script for for the below request., There are two different tables(sample1, sample2) in different schemas(s_schema1, s_schema2). Unix shell script to compare the columns of two different tables of two... (2 Replies)
Discussion started by: Rajkumar Gopal
2 Replies

9. Shell Programming and Scripting

How to use V$tables in UNIX shell script?

Hi All, In my script I have used the below code to retrieve the instance name V_INSTANCE_NAME=`sqlplus -s ${APPS_USR_PSWD} <<+ set pagesize 0 linesize 256 feedback off verify off head off echo off set serveroutput off select... (2 Replies)
Discussion started by: kalidoss
2 Replies

10. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies
routing(7)						 Miscellaneous Information Manual						routing(7)

NAME
routing - system support for local network packet routing DESCRIPTION
The network facilities for HP-UX provide general packet routing support. Routing table maintenance is handled by application processes. A routing table consists of a set of data structures used by the network facilities to select the appropriate remote host or gateway when transmitting packets. The table contains a single entry for each route to a specific network or host, as displayed by the command with the or options (see netstat(1)). Routes that are not valid are not displayed. _______________________________________________________________ # netstat -r Routing tables Destination Gateway Flags Refs Use Interface Pmtu hpindwr.cup.hp.com localhost UH 1 39 lo0 4608 localhost localhost UH 0 68 lo0 4608 147.253.56.195 localhost UH 0 0 lo0 4608 147.253.144.66 localhost UH 0 0 lo0 4608 default hpinsmh.cup.hp.com UG 1 21 lan0 1500 15.13.136 hpindwr.cup.hp.com U 1 92 lan0 1500 147.253.56 147.253.56.195 U 0 7 lan2 1500 147.253.144.64 147.253.144.66 U 0 7 lan1 1500 _______________________________________________________________ # netstat -rn Routing tables Destination Gateway Flags Refs Use Interface Pmtu 15.13.136.66 127.0.0.1 UH 1 39 lo0 4608 127.0.0.1 127.0.0.1 UH 0 68 lo0 4608 147.253.56.195 127.0.0.1 UH 0 0 lo0 4608 147.253.144.66 127.0.0.1 UH 0 0 lo0 4608 default 15.13.136.11 UG 2 30 lan0 1500 15.13.136.0 15.13.136.66 U 1 113 lan0 1500 147.253.56.0 147.253.56.195 U 0 7 lan2 1500 147.253.144.64 147.253.144.66 U 0 7 lan1 1500 _______________________________________________________________ # netstat -rv Routing tables Dest/Netmask Gateway Flags Refs Use Interface Pmtu hpindwr.cup.hp.com/0xffffffff localhost UH 1 39 lo0 4608 localhost/0xffffffff localhost UH 0 68 lo0 4608 147.253.56.195/0xffffffff localhost UH 0 0 lo0 4608 147.253.144.66/0xffffffff localhost UH 0 0 lo0 4608 default/0x00000000 hpinsmh.cup.hp.com UG 2 31 lan0 1500 15.13.136/0xfffff800 hpindwr.cup.hp.com U 1 129 lan0 1500 147.253.56/0xfffffe00 147.253.56.195 U 0 7 lan2 1500 147.253.144.64/0xfffffff0 147.253.144.66 U 0 7 lan1 1500 _______________________________________________________________ # netstat -rnv Routing tables Dest/Netmask Gateway Flags Refs Use Interface Pmtu 15.13.136.66/255.255.255.255 127.0.0.1 UH 1 39 lo0 4608 127.0.0.1/255.255.255.255 127.0.0.1 UH 0 68 lo0 4608 147.253.56.195/255.255.255.255 127.0.0.1 UH 0 0 lo0 4608 147.253.144.66/255.255.255.255 127.0.0.1 UH 0 0 lo0 4608 default/0.0.0.0 15.13.136.11 UG 3 40 lan0 1500 15.13.136.0/255.255.248.0 15.13.136.66 U 1 153 lan0 1500 147.253.56.0/255.255.254.0 147.253.56.195 U 0 8 lan2 1500 147.253.144.64/255.255.255.240 147.253.144.66 U 0 8 lan1 1500 _______________________________________________________________ The following columns are of particular interest: The destination Internet address: host name, network name, or The keyword indicates a wildcard route, used as a last resort if no route is specified for a particular remote host or network. See The netmask and the destination Internet address together define a range of IP addresses that may be reached by the route's gateway. A host route by default has a netmask of all 1's. A default route by default has a netmask of all 0's. The netmask is also used in selecting a route to forward an IP packet. See the subsection. The gateway to use to get to the destination: a remote gateway or the local host. See The type of route: The route is "up" or available (see ifconfig(1M)). The route uses a remote host as a gateway; otherwise, the local host is shown as the gateway (see route(1M)). The destination is a host; otherwise, the destination is a network (see route(1M)). The interface connections: The local loopback after system boot. The interface cards installed on the local host after the command is executed at boot time (see ifconfig(1M)). The values of the count and destination type fields in the command determine the presence of the and flags in the display and thus the route type, as shown in the following table. Count Destination Type Flags Route Type ------------------------------------------------------------- =0 network U Route to a network directly from the local host >0 network UG Route to a network through a remote host gateway =0 host UH Route to a remote host directly from the local host >0 host UGH Route to a remote host through a remote host gateway =0 default U Wildcard route directly from the local host >0 default UG Wildcard route through a remote host gateway ------------------------------------------------------------- Subnets The network facilities support variable-length subnetting. An Internet address is made up of a portion, and a portion of an address in the form: Subnet addresses are defined as a portion of the network's Internet address. This scheme provides for: o Network addresses that identify physically distinct networks. o Subnet addresses that identify physically distinct subnetworks of the same network. A network manager can subdivide the Internet address of the local network into subnets using the host number space. This facility allows several physical networks to share a single Internet address. To allow for this, three Internet classes are defined, each accommodating a different amount of network and host addresses. The address classes are defined by the most significant bit of the binary form of the address. The following table lists the number of networks, nodes, and the address ranges for each address class: Nodes per Class Networks Network Address Range -------------------------------------------------------------- A 127 16777215 0.0.0.1 - 127.225.225.254 B 16383 65535 128.0.0.1 - 191.255.255.254 C 2097151 255 192.0.0.1 - 223.244.244.243 Reserved -- -- 224.0.0.0 - 255.255.255.255 -------------------------------------------------------------- The first 8 bits of a Class A network has network space for only 127, while accommodating the largest number of nodes possible among the classes defined. A single class B network has the network address limitation of 16 bits, and 16 bits to define the nodes. For example, a Class C address space is as follows: ______________________________________ Indicates Class C Class C subnet networks portion | | --- --- 10000000.00000110.00000001.11100001 -------------------------- ----- | | Network Address Host = 192.6.1 Address = 1 ______________________________________ A subnet for a given host is specified with the command (see ifconfig(1M)), using the parameter with a 32-bit subnet mask. The default masks for the three classes of Internet addresses are as follows: Class A: 255.0.0.0 Class B: 255.255.0.0 Class C: 255.255.255.0 An example Class C network number is 192.34.17.0. The last field specifies the host number. Thus, all hosts with the prefix 192.34.17 are recognized as being on the same logical and physical network. If subnets are not in use, the default mask used is 255.255.255.0. If subnets are used and the 8-bit host field is partitioned into 3 bits of subnet and 5 bits of host as in the above example, then the sub- net mask would be 255.255.255.192. If a host has multiple interfaces, then it can belong to different subnets. Unlike past releases, the subnets can have different sizes even if they may have the same network address. This is accomplished by using a different netmask on each of the host interfaces. For example, the and interface shown in the tables above are connected to two distinct subnets of the same network, 147.253. The subnet that belongs to can have at most 14 hosts, because its netmask is 255.255.255.240. Note: The host portion of those IP addresses in the subnet cannot be all 1's or all 0's, therefore this subnet can support only 14 hosts, not 16. The subnet that belongs to can have up to 510 hosts, because its netmask is 255.255.254.0. Supernets A supernet is a collection of smaller networks. Supernetting is a technique of using the netmask to aggregate a collection of smaller net- works into a supernet. This technique is particularly useful for class C networks. A Class C network can only have 254 hosts. This can be too restrictive for some companies. For these companies, a netmask that only contains a portion of the network part can be applied to the hosts in these class C networks to form a supernet. This supernet netmask should be applied to those interfaces that connect to the supernet using the ifconfig command (see ifconfig(1M)). For example, a host can configure its interface to connect to a class C supernet, for example, 192.6, by configuring an IP address of 192.6.1.1 and a netmask of 255.255.0.0 to its interface. Routing Algorithm The routing table entries are of three types: o Entries for a specific host. o Entries for all hosts on a specific network. o Wildcard entries for any destination not matched by entries of the first two types. To select a route for forwarding an IP packet, the network facilities select the complete set of "matching" routing table entries from the routing table. A routing table entry is considered a match, if the result of the bit-wise AND operation between the netmask in the routing entry and the IP packet's destination address equals the destination address in the routing entry. The network facilities then select from the set the routing entries that have the longest netmask. The length of a netmask is defined as the number of contiguous 1 bits starting from the leftmost bit position in the 32-bit netmask field. In other words, the network facili- ties select the routing entry that specifies the narrowest range of IP addresses. For example, the host route entry that has a destina- tion/netmask pair of (147.253.56.1, 0xFFFFFFFF), is more specific than the network route entry that has a destination/netmask pair of (147.253.56.0, 0xFFFFFE00); therefore, the network facilities select the host route entry. The default route by default has a destina- tion/netmask pair of (0,0). Therefore, the default route matches all destinations but it is also the least specific. The default route will be selected only if there is not a more specific route. There may still be multiple routing entries remaining. In that case, the IP packet is routed over the first entry displayed by Such multi- ple routes include: o Two or more routes to a host via different gateways. o Two or more routes to a network via different gateways. A superuser can change entries in the table by using the command (see route(1M), or by information received in Internet Control Message Protocol (ICMP) redirect messages. If there are more than one default gateways for a particular net or subnet, each will be used in turn to effect the even distribution of datagrams to the different gateways. WARNINGS
Reciprocal commands must be executed on the local host and the destination host, as well as all intermediate hosts, if routing is to suc- ceed in the cases of virtual circuit connections or bidirectional datagram transfers. AUTHOR
was developed by the University of California, Berkeley. FILES
SEE ALSO
netstat(1), ifconfig(1M), route(1M), route(7P). routing(7)
All times are GMT -4. The time now is 02:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy