Download presentation
Presentation is loading. Please wait.
Published byLuke Blake Modified over 9 years ago
1
Fall 2004FSU CIS 5930 Internet Protocols1 IP Routing Reading: Chapter 16
2
Fall 2004FSU CIS 5930 Internet Protocols2 IP routing IP PPP IEEE 802.3 TCP IP PPP End system TCP IP IEEE 802.3 End systemIntermediate system (Router) Network Transport Data link and physical
3
Fall 2004FSU CIS 5930 Internet Protocols3 Networks and routers Network 1: Token Ring (IEEE 802.5) Network 2: PPP Network 4: Fast Ethernet Network 3: Ethernet (IEEE 802.3) Network 5: Wireless LAN (IEEE 802.11) Connection to the other networks of the Internet Router A Router B Router C
4
Fall 2004FSU CIS 5930 Internet Protocols4 Forwarding vs. routing Forwarding –Given a packet, determining the next hop toward destination by consulting some routing table –Per packet behavior –In kernel Routing –Collecting/exchanging topology and state information, computing shortest path to destinations, constructing routing table –Periodically or event driven –In user space (some routing daemon)
5
Fall 2004FSU CIS 5930 Internet Protocols5 IP addresses Class-based ones –A, B, C, D, E –Inferring network part from addresses Classless one (CIDR) –Explicitly network mask –192.168.152.0/21 –192.168.152.0/255.255.248.0
6
Fall 2004FSU CIS 5930 Internet Protocols6 An example Connection to the other networks of the Internet Router A Router B Router C 10.0.2.210.0.2.110.0.3.1 10.0.3.3 10.0.4.3 10.0.4.1 10.0.4.2 10.0.5.1 10.0.5.210.0.5.3 10.0.3.2 10.0.1.210.0.1.4 10.0.1.3 10.0.1.1 10.0.0.1
7
Fall 2004FSU CIS 5930 Internet Protocols7 Routing table for Routing B DestinationNetwork maskRouterInterface 10.0.3.0255.255.255.0eth0 10.0.4.0255.255.255.0eth1 10.0.5.0255.255.255.010.0.4.3eth1 10.0.2.0255.255.255.0ppp0 0.0.0.0 10.0.2.1ppp0
8
Fall 2004FSU CIS 5930 Internet Protocols8 Some concepts Longest prefix matching –More specific entries are preferred Routing cache –Most recently used routing entries –To speed up forwarding Rule-based routing –A unified way to organize different routing tables –local (local router), main (general table), default (default routing entry) –Each with a priority
9
Fall 2004FSU CIS 5930 Internet Protocols9 Implementation Data structures –Routing rules –Routing tables –Routing cache Functions –Forwarding lookup functions –Management functions
10
Fall 2004FSU CIS 5930 Internet Protocols10 Routing rules fib_rules r_next r_clntref: 2 r_preference: 0 r_table: RT_TABLE_LOCAL r_action: RTN_UNICAST r_dst_len: 0 r_src_len: 0 r_src: 0x0 r_srcmask: 0x0 fib_rule r_dst: 0x0 r_dstmask: 0x0 r_srcmap: 0x0 r_flags: 0 r_tos: 0 r_ifindex: 0 r_ifname[...]: ““ r_dead: 0 r_next: 0x0 r_clntref: 2 r_preference: 32767 r_table: RT_TABLE_DEFAULT r_action: RTN_UNICAST fib_rule r_next r_clntref: 2 r_preference: 32766 r_table: RT_TABLE_MAIN r_action: RTN_UNICAST fib_rule...
11
Fall 2004FSU CIS 5930 Internet Protocols11 Functions fib_lookup(rt_key, …) –Searching for matching rules –If found Get the routing table (fib_get_table()) Looking up an entry in the table (tb_lookup()) rt_key structure –dst, src, iif, oif, tos, scope,etc
12
Fall 2004FSU CIS 5930 Internet Protocols12 Routing tables tb_id: 254 tb_stamp tb_lookup() tb_insert() tb_delete() tb_dump() tb_flush() tb_get_info() tb_select_default() fib_table tb_id: 1... fib_table tb_id: 255... fib_table fib_tables[255] fz_next: 0x0 fn_zone fz_hash fz_divisor: 1 fz_hashmask: 0x0 fz_order: 0 fz_mask: 0 fz_next fn_zone fz_hash fz_divisor: 16 fz_hashmask: 0xf fz_order: 16 fz_mask: 0xffff fz_next fn_zone fz_hash fz_divisor: 16 fz_hashmask: 0xf fz_order: 24 fz_mask: 0xffffff fib_node*[1] fib_node*[16] fn_zones[33] fn_hash fn_zone_list 0 16 24 1 254 255 fib_table
13
Fall 2004FSU CIS 5930 Internet Protocols13 Zone, node, and info fn_next fn_info fn_key fn_tos fn_type fn_scope fn_state fib_nodefib_node*[16] 0 15 fib_node next prev fib_treeref fib_clntref fib_dead fib_flags fib_prefsrc fib_info fib_priority fib_metrics[...] fib_nhs nh_dev fib_nh nh_flags nh_scope nh_oif nh_gw fib_node fn_next fn_info fib_node... next prev: 0x0 ??? fib_info... fib_info_cnt fib_info_list fib_node fib_info net_dev
14
Fall 2004FSU CIS 5930 Internet Protocols14 Routing cache... next dst_entry rtable net_dev chain rt_hash_bucket lock... dev... neighbour hh input() output() ops hh_cache neighbour dst_ops rt_flags gc() check() reroute() destroy() negative_advice() rt_hash_table[] rt_hash_bucket 0 16 rtable link_failure() negative_advice() entries... inet_peer rtable rt_type rt_dst rt_src rt_iif rt_gateway rt_key rt_spec_dst inet_peer
15
Fall 2004FSU CIS 5930 Internet Protocols15 Forwarding functions ip_route_input() –For handling incoming packet –Searching cache first, done if found –Depending on destination address Multicast: ip_route_input_mc() Otherwise: ip_route_input_slow()
16
Fall 2004FSU CIS 5930 Internet Protocols16 Forwarding functions ip_route_input_slow() –Sanity checking –FIB query by fib_lookup() –Depending on if local address If local: dst.input <- ip_local_delivery() Otherwise: –Making the outgoing interface is up –dst.Input <- ip_forward() –dst.Output <- ip_output()
17
Fall 2004FSU CIS 5930 Internet Protocols17 Forwarding functions ip_route_output() –For locally generated packets –Creating rt_key structure –Passing on to ip_route_output_key() ip_route_output_key() –Searching routing cache –If not found ip_route_output_slow()
18
Fall 2004FSU CIS 5930 Internet Protocols18 Forwarding functions ip_route_output_slow() –Searching routing table –Local vs. nonlocal Local: ip_local_delivery() Nonlocal: –Dst.output <- ip_ouput() –Entering the result into routing cache
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.