Ipv4/Ipv6 Routing: - Veerakumar M - 25-03-2019

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 18

IPv4/IPv6 Routing

• Veerakumar M
• 25-03-2019

1 © Nokia Solutions and Networks 2018 For internal use only


Agenda

• What is routing?
• What routing table contains?
• Routing Lookup process
• IP address display
• Routing table display
• Packet forwarding
• When is routing table referred?
• rtnetlink - Linux IPv4/IPv6 routing socket
• Linux Packet processing
• Route lookup in netfilter
• Nokia Troubleshooting help

2 © Nokia Solutions and Networks 2018 For internal use only


What is routing?
• Routing is a means of sending an IP packet from one point to another.
• Its a simple process in which the host sends the IP datagram directly to the destination if the
destination host is connected.
• A routing table is a set of rules, which referred to do routing lookup.
• Host or Router needs routing table to forward the packets to next hop.
• Routing in IPv6 is performed in the same way as IPv4 but it requires two distinct routing tables. One
for IPv4 routes and another for IPv6 routes

3 © Nokia Solutions and Networks 2018 For internal use only


What routing table contains?
A basic routing table includes the following information:
• Destination: The destination network or destination host.
• Next hop: The IP address to which the packet is forwarded
• Interface: The outgoing network interface the device should use when forwarding the packet to the
next hop or final destination
• Metric: Routing preference if destination ip matches multiple routes.
• Flags : Possible flags include
U (route is up), H (target is a host), G (use gateway), R (reinstate route for dynamic routing)
D (dynamically installed by daemon or redirect), M (modified from routing daemon or redirect)
A (installed by addrconf), C (cache entry), ! (reject route
[root@host1 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.254 0.0.0.0 UG 100 0 0 br1
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 br1

4 © Nokia Solutions and Networks 2018 For internal use only


Routing Lookup process
Egress packet A

Yes Yes
Check arp Check
cache routing
cache
No
No
Lookup routing policy
database

Lookup routing entries in Send “ICMP Host Network”


routing table unreachable” message
if no routes are
matched
Trigger neighbor discovery

Send Packet A on outgoing


interface

5 © Nokia Solutions and Networks 2018 For internal use only


Different types of routes

Host route - A route to a specific internetwork address (Network ID and Host ID). Host routes are added
automatically when ip address is configured.
ip addr add 10.41.218.0/25 dev br1.192
Ip addr add 10.41.219.0/25 dev br1.193

Static network route - A route to a specific Network ID in the internetwork.


ip route add 10.58.248.156 via 10.41.218.1 metric 1
ip route add 10.58.248.156 via 10.41.218.2 metric 2

Default route - A route that is used when no other routes for the destination are found in the routing table.
ip route add default via 10.41.218.3
ip route add default via 10.41.218.3

6 © Nokia Solutions and Networks 2018 For internal use only


IP address display

Ip addr show
br1.192@br1: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
group default qlen 1000
link/ether 60:a8:fe:66:29:23 brd ff:ff:ff:ff:ff:ff
inet 10.41.218.19/25 brd 10.41.218.127 scope global br1.192
valid_lft forever preferred_lft forever
inet6 fe80::62a8:feff:fe66:2923/64 scope link
valid_lft forever preferred_lft forever
br1.193@br1: <BROADCAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP
group default qlen 1000
link/ether 60:a8:fe:66:29:23 brd ff:ff:ff:ff:ff:ff
inet 10.41.219.19/25 brd 10.41.219.127 scope global br1.193
valid_lft forever preferred_lft forever
inet6 fe80::62a8:feff:fe66:2923/64 scope link
valid_lft forever preferred_lft forever

7 © Nokia Solutions and Networks 2018 For internal use only


Routing table display

ip rule show (Routing policy database)

0: from all lookup local


32766: from all lookup main
32767: from all lookup default

e.x Packet source and destination ip


ip route show table main (routing table) address
default via 10.41.218.3 dev br1.192 # Default route (src –X , dst - 10.42.21.3)
10.41.218.0/25 dev br1.192 proto kernel scope link src 10.41.218.19 # Host route (src – X, dst - 10.41.218.10)
10.41.219.0/25 dev br1.193 proto kernel scope link src 10.41.219.19 # Host route (src – X, dst - 10.41.219.10)
10.58.248.156 via 10.41.218.1 dev br1.192 proto unspec metric 1 # static network route (src – X, dst - 10.58.248.156)
10.58.248.156 via 10.41.218.2 dev br1.192 proto unspec metric 2 # static network route

Lookup
Order

8 © Nokia Solutions and Networks 2018 For internal use only


Neighbor table

e.x Packet source and destination ip


ip neigh show
address
10.41.218.10 dev br1.192 lladdr d4:6d:50:d8:e8:10 REACHABLE # (src – X, dst - 10.41.218.10)
10.41.219.10 dev br1.193 lladdr a8:9d:21:d6:66:24 REACHABLE # (src – X, dst - 10.41.219.10)
10.41.218.10
10.41.218.1 dev br1.192 lladdr d4:6d:50:d8:e8:11 REACHABLE # (src – X, dst - 10.58.248.156)
10.41.218.3 dev br1.192 lladdr d4:6d:50:d7:e9:10 REACHABLE # (src –X , dst - 10.42.21.3)

9 © Nokia Solutions and Networks 2018 For internal use only


Packet forwarding

10 © Nokia Solutions and Networks 2018 For internal use only


Longest prefix match routing

11 © Nokia Solutions and Networks 2018 For internal use only


When is routing table referred?

• All Egress Mplane, Cplane, Splane packets in host


• All Egress Ipsec ESP packet after encryption in fastpath
• Routing tables are referred before fragmentation

12 © Nokia Solutions and Networks 2018 For internal use only


rtnetlink - Linux IPv4/IPv6 routing socket
rtnetlink_socket = socket(AF_NETLINK,SOCKET_RAW, NETLINK_ROUTE);

• NETLINK is a facility in the Linux operating system for user-space applications to communicate with the kernel.
• Netlink is an internal communication protocol.
• Rtnetlink allows the kernel's routing tables to be read and altered.
• Netlink sockets are accessed like any other sockets. Both socket calls and system IO calls will work with netlink
sockets.
• Iproute2 utilities are used to configure link, ip address, neighbor entry and routes
• ip link - RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK
• ip addr - RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR
• ip route - RTM_NEWROUTE, RTM_DELROUTE, RTM_GETROUTE
• ip neigh - RTM_NEWNEIGH, RTM_DELNEIGH, RTM_GETNEIGH
• ip rule - RTM_NEWRULE, RTM_DELRULE, RTM_GETRULE

13 © Nokia Solutions and Networks 2018 For internal use only


Linux Packet processing

14 © Nokia Solutions and Networks 2018 For internal use only


Route lookup in netfilter

15 © Nokia Solutions and Networks 2018 For internal use only


Nokia Troubleshooting help

• Host Routes and neighbor table can be referred in ExtendedSystemInfo.log


 grep “ip route” to check routing table entries
 grep “ip neigh” to check arp table entries

• FSMr3: Fastpath routing tables can be referred in dump_routing_table.txt


• FSMr3: Fastpath neighbor table can be referred in dump_arp_table.txt
• Firewall rules are available in ExtendedSystemInfo.log
 grep “iptables” to check firewall rules for ipv4 and ipv6

• Use “ip rule show” command to check Linux routing policy


• Use “ip route show” command to check Linux routing table
• Use “ip neigh show” command to check neighbor table
• Use “netstat –an” command to check Linux tcp/udp/unix sockets status and binded port number
• “tcpdump –ni <iface>” on outgoing interface

16 © Nokia Solutions and Networks 2018 For internal use only


Links

• rtnetlink - https://www.systutorials.com/docs/linux/man/7-rtnetlink/
• Iproute2 utilities - https://en.wikipedia.org/wiki/Iproute2
• netfilter diagram - https://commons.wikimedia.org/wiki/File:Netfilter-packet-flow.svg
• Routing steps - http://www.firewall.cx/networking-topics/routing/181-routing-process.html

17 © Nokia Solutions and Networks 2018 For internal use only


For internal use only

You might also like