News Update :

Busines

Hiburan

Showing posts with label Other. Show all posts
Showing posts with label Other. Show all posts

Best Path Best Path And Metric

Determining a router's best path involves the evaluation of multiple paths to the same destination network and selecting the optimum or "shortest" path to reach that network. Whenever multiple paths to reach the same network exist, each path uses a different exit interface on the router to reach that network. The best path is selected by a routing protocol based on the value or metric it uses to determine the distance to reach a network. Some routing protocols, such as RIP, use simple hop-count, which the number of routers between a router and the destination network. Other routing protocols, such as OSPF, determine the shortest path by examining the bandwidth of the links, and using the links with the fastest bandwidth from a router to the destination network.

Dynamic routing protocols typically use their own rules and metrics to build and update routing tables. A metric is the quantitative value used to measure the distance to a given route. The best path to a network is the path with the lowest metric. For example, a router will prefer a path that is 5 hops away over a path that is 10 hops away.

The primary objective of the routing protocol is to determine the best paths for each route to include in the routing table. The routing algorithm generates a value, or a metric, for each path through the network. Metrics can be based on either a single characteristic or several characteristics of a path. Some routing protocols can base route selection on multiple metrics, combining them into a single metric. The smaller the value of the metric, the better the path.

Comparing Hop Count and Bandwidth Metrics

Two metrics that are used by some dynamic routing protocols are:
Hop count-Hop count is the number of routers that a packet must travel through before reaching its destination. Each router is equal to one hop. A hop count of four indicates that a packet must pass through four routers to reach its destination. If multiple paths are available to a destination, the routing protocol, such as RIP, picks the path with the least number of hops.
Bandwidth-Bandwidth is the data capacity of a link, sometimes referred to as the speed of the link. For example, Cisco's implementation of the OSPF routing protocol uses bandwidth as its metric. The best path to a network is determined by the path with an accumulation of links that have the highest bandwidth values, or the fastest links. The use of bandwidth in OSPF will be explained in Chapter 11.

Note: Speed is technically not an accurate description of bandwidth because all bits travel at the same speed over the same physical medium. Bandwidth is more accurately defined as the number of bits that can be transmitted over a link per second.

When hop count is used as the metric, the resulting path may sometimes be suboptimal. For example, consider the network shown in the figure. If RIP is the routing protocol used by the three routers, then R1 will choose the suboptimal route through R3 to reach PC2 because this path has fewer hops. Bandwidth is not considered. However, if OSPF is used as the routing protocol, then R1 will choose the route based on bandwidth. Packets will be able to reach their destination sooner using the two, faster T1 links as compared to the single, slower 56 Kbps link.

Packet Fields and Frame Fields

As we discussed previously, routers make their primary forwarding decision by examining the destination IP address of a packet. Before sending a packet out the proper exit interface, the IP packet needs to be encapsulated into a Layer 2 data link frame. Later in this section we will follow an IP packet from source to destination, examining the encapsulation and decapsulation process at each router. But first, we will review the format of a Layer 3 IP packet and a Layer 2 Eternet frame.

Internet Protocol (IP) Packet Format

The Internet Protocol specified in RFC 791 defines the IP packet format. The IP packet header has specific fields that contain information about the packet and about the sending and receiving hosts. Below is a list of the fields in the IP header and a brief description for each one. You should already be familiar with destination IP address, source IP address, version, and Time To Live (TTL ) fields. The other fields are important but are outside the scope of this course.
Version - Version number (4 bits); predominant version is IP version 4 (IPv4)
IP header length - Header length in 32-bit words (4 bits)
Precedence and type of service - How the datagram should be handled (8 bits); the first 3 bits are precedence bits (this use has been superseded by Differentiated Services Code Point [DSCP], which uses the first 6 bits [last 2 reserved])
Packet length - Total length (header + data) (16 bits)
Identification - Unique IP datagram value (16 bits)
Flags - Controls fragmenting (3 bits)
Fragment offset - Supports fragmentation of datagrams to allow differing maximum transmission units (MTUs) in the Internet (13 bits)
Time to Live (TTL) - Identifies how many routers can be traversed by the datagram before being dropped (8 bits)
Protocol - Upper-layer protocol sending the datagram (8 bits)
Header checksum - Integrity check on the header (16 bits)
Source IP address - 32-bit source IP address (32 bits)
Destination IP address - 32-bit destination IP address (32 bits)
IP options - Network testing, debugging, security, and others (0 or 32 bits, if any)

MAC Layer Frame Format

The Layer 2 data link frame usually contains header information with a data link source and destination address, trailer information, and the actual transmitted data. The data link source address is the Layer 2 address of the interface that sent the data link frame. The data link destination address is the Layer 2 address of the interface of the destination device. Both the source and destination data link interfaces are on the same network. As a packet is forwarded from router to router, the Layer 3 source and destination IP addresses will not change; however, the Layer 2 source and destination data link addresses will change. This process will be examined more closely later in this section.

Note: When NAT (Network Address Translation) is used, the destination IP address does change, but this process is of no concern to IP and is a process performed within a company's network. Routing with NAT is discussed in a later course.

The Layer 3 IP packet is encapsulated in the Layer 2 data link frame associated with that interface. In this example, we will show the Layer 2 Ethernet frame. The figure shows the two compatible versions of Ethernet. Below is a list of the fields in an Ethernet frame and a brief description of each one.
Preamble - Seven bytes of alternating 1s and 0s, used to synchronize signals
Start-of-frame (SOF) delimiter - 1 byte signaling the beginning of the frame
Destination address - 6 byte MAC address of the sending device on the local segment
Source address - 6 byte MAC address of the receiving device on the local segment
Type/length - 2 bytes specifying either the type of upper layer protocol (Ethernet II frame format) or the length of the data field (IEEE 802.3 frame format)
Data and pad - 46 to 1500 bytes of data; zeros used to pad any data packet less than 46 bytes
Frame check sequence (FCS) - 4 bytes used for a cyclical redundancy check to make sure the frame is not corrupted

User-Space Tunneling

User-space tunnels are not an integral part of the operating system. They carry out their duty on top of TCP and UDP. This section discusses several representative examples, but a much larger variety exists. Several approaches are designed to circumvent corporate security by creating transparent tunnels (tcp80/tcp443) over HTTP(S) proxies or SOCKS5 relays.

Note that I do not discuss these approaches; they are potentially dangerous for corporate security. In addition, to a large extent, they are responsible for deployments of expensive and performance-impaired application layer gateways. Security compromises from the inside are difficult to tackle, time-consuming, and considerably increase administrative and logging burden. Proxies are there for good reasons and add security to corporate Internet architectures. Transparent proxies are one building block of modern security architectures; their caching purpose is of diminishing importance. Olaf Titz, from the CIPE Project,[3] says it best:

There are several different places where encryption can be built in to an existing network infrastructure, corresponding to the different protocol layers:

On the network level— Packets traveling between hosts on the network are encrypted. The encryption engine is placed near the driver, which sends and receives packets. An implementation is found in CIPE.

On the socket level— A logical connection between programs running on different hosts (TCP connection; transport or session layer in OSI) is encrypted. The encryption engine intercepts or proxies connections. SSH and SSL work this way.

On the application level— Applications contain their own encryption engine and encrypt data themselves. The best-known example is PGP for encrypting mail.

CIPE (Crypto IP Encapsulation)
CIPE is an established tunnel approach in the Linux community, based on tunneling IP datagrams over encrypted UDP carrier datagrams. This procedure offers transparency in contrast to TCP-tied approaches such as secure shell (SSH) or Secure Sockets Layer (SSL). CIPE creates point-to-point tunnels differentiated by port number. Because of its lightweight and elegant design, its performance characteristics are impressive. It behaves well in NAT and SOCKS5 relay environments, can to some extent handle dynamic IP addresses, and is based on Blowfish/IDEA cryptographic algorithms with a 128-bit key length.

CIPE also was ported to the Windows 2000 Server platform. The CIPE protocol performs two main tasks: encryption and checksumming of the payload packets, and dynamic key exchange. The CIPE suite consists of a kernel module, which resembles a pseudo network device, the ciped driver, and the pkcipe utility for key management. pkcipe introduced Diffie-Hellman key exchange and RSA signatures to tackle the security problem of long-lived static keys and administrative burden with many tunnels. As we know from partial or full-meshed IPSec architectures, point-to-point tunnels scale horribly (one issue successfully addressed by MPLS VPNs). For installation and operational details, consult the CIPE page at http://sites.inka.de/sites/bigred/devel/cipe.html. The next version of CIPE will take advantage of the Linux CryptoAPI, thus marking another major step toward a homogeneous architecture on Linux.

CIPE links can be qualified as belonging to different classes of carriers. Those classes are based on how they are able to reach the Internet:[4]

Direct connection on a static IP address

Direct connection on a dynamic IP address

Indirect connection through a SOCKS server

Indirect connection through a NAT (masquerading) router

Example 11-10 demonstrates a static CIPE setup between two Linux gateways and a configuration with pkcipe.

Example 11-10. Linux CIPE Tunnel Setup

[root@callisto:~#] modprobe cipcb cipe_debug=0



[root@callisto:/etc/cipe#] ls -al

total 36

drwx------ 3 root root 4096 Aug 15 16:27 ./

drwxr-xr-x 86 root root 8192 Aug 15 10:15 ../

-rw-r----- 1 root root 272 Aug 15 12:37 identity

-r-------- 1 root root 887 Aug 15 12:37 identity.priv

-rwxr-x--- 1 root root 620 Feb 22 2002 ip-down*

-rwxr-x--- 1 root root 1632 Feb 22 2002 ip-up*

-rw------- 1 root root 679 Aug 15 12:40 options

drwx------ 2 root root 4096 Aug 15 12:37 pk/



[root@callisto:/etc/cipe#] cat options

# This is probably the minimal set of options that has to be set

# Without a "device" line, the device is picked dynamically



# the peer's IP address

ptpaddr 10.1.1.2

mask 255.255.255.252

# our CIPE device's IP address

ipaddr 10.1.1.1

# my UDP address. Note: if you set port 0 here, the system will pick

# one and tell it to you via the ip-up script. Same holds for IP 0.0.0.0.

me 192.168.1.1:6789

# ...and the UDP address we connect to. Of course no wildcards here.

peer 192.168.1.2:6543

# The static key. Keep this file secret!

# The key is 128 bits in hexadecimal notation.

key 3248fd20adf9c00ccf9ecc2393bbb3e4



[root@callisto:/etc/cipe/pk#] cat pollux

-----BEGIN PUBLIC KEY-----

MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDl3o1MUEQN8IjZ9g74OwO1i8Cn

+nveaW0rqsH8qDmgwe2ofQH2RdHADhd+OgbWDzODxlKp/iSTPAExeDo2gvfy+V3f

cFn04T+Zsng5uDl6YZ/h35r937l9ve/XoxDGzIyg1RSnl6xvIsO9BFu6J7dc5JES

+bzICr4T58q6kauTlwIDAQAB

-----END PUBLIC KEY-------

ipaddr 10.1.1.1

ptpaddr 10.1.1.2

mask 255.255.255.252



[root@callisto:~#] modprobe cipcb cipe_debug=1 cipe_maxdev=10



[root@callisto:~#] ciped-cb -o /etc/cipe/options



[root@callisto:~#] ifconfig -a

cipcb0 Link encap:IPIP Tunnel HWaddr

inet addr:10.1.1.1 P-t-P:10.1.1.2 Mask:255.255.255.252

UP POINTOPOINT RUNNING NOARP MTU:1442 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:42 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:100

RX bytes:0 (0.0 b) TX bytes:7104 (6.9 Kb)



[root@callisto:/etc/xinetd.d#] cat pkcipe

service pkcipe

{

socket_type = stream

protocol = tcp

wait = no

user = root

server = /usr/local/sbin/pkcipe

server_args = -s 963

disable = no

}



[root@pollux:~#] pkcipe -c 192.168.1.1:pkcipe




V-TUN (Virtual Tunnel)
V-TUN (http://vtun.sourceforge.net/) runs on Linux, BSD, and Solaris platforms. I consider it the most flexible and feature-rich package for VPN deployments outside kernel space. It supports encryption, traffic shaping, and compression for TCP-/UDP-based tunnels for point-to-point VPN or mobile IP architectures via IP, PPP, SLIP, Ethernet, and other tunnel types. V-TUN requires the universal TUN/TAP driver, which resembles a virtual point-to-point network device or virtual Ethernet network device respectively and can be found at http://vtun.sourceforge.net/tun/index.html.

The good news is that on all tested current operating systems (Linux 2.4, OpenBSD 3.3, FreeBSD 4.6, NetBSD 1.6.1), the TUN/TAP driver is an integral part or module of the kernel. It requires recompiling of the kernels but no additional software besides V-TUN. For additional information, consult the man pages vtund(8) and vtund.conf(5).

Examples 11-11 and 11-12 demonstrate a V-TUN setup between Linux and OpenBSD.

Example 11-11. V-TUN Tunnel Setup on Linux

[root@callisto:~#] modprobe tun

[root@callisto:/etc#] cat vtund.myconfig

options {

port 5000; # Listen on this port.



# Syslog facility

syslog daemon;



# Path to various programs

ppp /usr/sbin/pppd;

ifconfig /sbin/ifconfig;

route /sbin/route;

firewall /sbin/iptables;

ip /sbin/ip;

}



default {

compress no; # Compression is off by default

speed 0; # By default maximum speed, No shaping

keepalive yes; # Keepalives

stat yes;

encrypt yes;

}



pollux {

passwd cisco; # Password

type tun; # IP tunnel

proto udp; # UDP protocol

compress lzo:9; # LZO compression level 9

device tun0;

encrypt yes; # Encryption

keepalive yes; # Keep connection alive

stat yes;

speed 128:64; # Tunnel shaping Kbps IN:OUT



up {

ifconfig "%% 10.2.2.1 pointopoint 10.2.2.2 mtu 1450";

};



down {

};

}



castor {

passwd cisco; # Password

type tun; # IP tunnel

proto udp; # UDP protocol

compress lzo:9; # LZO compression level 9

device tun1;

encrypt yes; # Encryption

keepalive yes; # Keep connection alive

stat yes;



up {

ifconfig "%% 10.3.3.1 pointopoint 10.3.3.2 mtu 1450";

};

}



europa {

passwd cisco; # Password

type tun; # IP tunnel

proto udp; # UDP protocol

compress lzo:9; # LZO compression level 9

device tun2;

encrypt yes; # Encryption

keepalive yes; # Keep connection alive

stat yes;



up {

ifconfig "%% 10.4.4.1 pointopoint 10.4.4.2 mtu 1450";

};

}



*** Start the vtund in server mode ***



[root@callisto:~#] vtund -s -f /etc/vtund.myconfig



[root@callisto:~#] ifconfig –a

...

tun2 Link encap:Point-to-Point Protocol

inet addr:10.4.4.1 P-t-P:10.4.4.2 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1450 Metric:1

RX packets:7 errors:0 dropped:0 overruns:0 frame:0

TX packets:10 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:10

RX bytes:588 (588.0 b) TX bytes:840 (840.0 b)

...



[root@callisto:~#] ps ax | )grep vtun

2404 ? S< 0:00 vtund[s]: europa tun tun2

6103 pts/4 S 0:00 grep vtun




Example 11-12. V-TUN Tunnel Setup on OpenBSD

[root@europa:~#] modprobe tun



[root@europa:/etc#] cat vtund.myconfig

options {

port 5000; # Connect to this port.

timeout 60; # General timeout



# Path to various programs

ppp /usr/sbin/pppd;

ifconfig /sbin/ifconfig;

route /sbin/route;

firewall /sbin/ipf;

}



default {

keepalive yes; # Keepalives

}



europa {

passwd cisco; # Password

device tun1; # Device tun1

#persist yes; # Persist mode

up {

ifconfig "%% 10.4.4.2 10.4.4.1 mtu 1450";

ifconfig "%% up";

#route "add -net 192.168.45.0/24 gw 10.4.4.1";

};

}



*** Start the vtund in client mode ***



[root@europa:~#] vtund -f /etc/vtund.myconfig europa 192.168.1.1



[root@europa:~#] ifconfig -A

...

tun1: flags=51 mtu 1450

inet 10.4.4.2 --> 10.4.4.1 netmask 0xff000000

...



[root@europa:~#] ping 10.4.4.1

PING 10.4.4.1 (10.4.4.1): 56 data bytes

64 bytes from 10.4.4.1: icmp_seq=0 ttl=64 time=1.350 ms

64 bytes from 10.4.4.1: icmp_seq=1 ttl=64 time=1.288 ms

64 bytes from 10.4.4.1: icmp_seq=2 ttl=64 time=1.227 ms

--- 10.4.4.1 ping statistics ---

3 packets transmitted, 3 packets received, 0% packet loss

round-trip min/avg/max/std-dev = 1.227/1.288/1.350/0.058 ms



[root@callisto:~#] tcpdump -i tun2

tcpdump: listening on tun2

18:32:32.081336 10.4.4.2 > 10.4.4.1: icmp: echo request

18:32:32.081351 10.4.4.1 > 10.4.4.2: icmp: echo reply

18:32:33.091594 10.4.4.2 > 10.4.4.1: icmp: echo request

18:32:33.091611 10.4.4.1 > 10.4.4.2: icmp: echo reply

18:32:34.101714 10.4.4.2 > 10.4.4.1: icmp: echo request

18:32:34.101730 10.4.4.1 > 10.4.4.2: icmp: echo reply




WARNING

Be aware of the fact that user-space tunneling solutions interfere with each other when run simultaneously. This might cause problems with binding to sockets or several programs controlling one and the same tun device. This is most certainly the case with V-TUN and OpenVPN. Never run these tools at the same time on the same gateway!



OpenVPN
OpenVPN (http://openvpn.sourceforge.net/) and V-TUN are somewhat related approaches, because both rely on the universal TUN/TAP driver to tunnel an IP subnet or virtual Ethernet adapter. OpenVPN is the most portable solution I came across in my evaluation. It can connect MAC OS X, Linux, BSD, Solaris, and Microsoft Windows via a VPN user-space daemon over TCP/UDP ports and a highly evolved SSL/TLS protocol integration (OpenSSL) with PKI support. It can handle dynamic IP addresses and operate in NAT environments. It offers tunnel bandwidth shaping, compression, encryption, and authentication featuring preshared key conventional encryption or certificate-based public key encryption. Example 11-13 demonstrates an example setup between Linux and OpenBSD.

Example 11-13. Callisto-to-Europa (OpenVPN Tunnel with Static-Key Security (Preshared Secret)

[root@europa:~#] openvpn --remote 192.168.14.1 --dev tun3 --ifconfig 10.5.5.2 10.5.5.1

--verb 5 --secret /etc/openvpn.key &



[root@europa:~#] ifconfig –A

...

tun3: flags=51 mtu 1256

inet 10.5.5.2 --> 10.5.5.1 netmask 0xffffffff

...



[root@callisto:~#] openvpn --remote 192.168.14.3 --dev tun3 --ifconfig 10.5.5.1 10.5.5.2

--verb 5 --secret /etc/openvpn.key &



[root@callisto:~#] ifconfig –a

...

tun3 Link encap:Point-to-Point Protocol

inet addr:10.5.5.1 P-t-P:10.5.5.2 Mask:255.255.255.255

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1256 Metric:1

RX packets:4 errors:0 dropped:0 overruns:0 frame:0

TX packets:30 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:10

RX bytes:336 (336.0 b) TX bytes:2520 (2.4 Kb)

...



[root@callisto:~#] ping 10.5.5.2

PING 10.5.5.2 (10.5.5.2) from 10.5.5.1 : 56(84) bytes of data.

WR64 bytes from 10.5.5.2: icmp_seq=1 ttl=255 time=1.36 ms

WR64 bytes from 10.5.5.2: icmp_seq=2 ttl=255 time=1.40 ms

WR64 bytes from 10.5.5.2: icmp_seq=3 ttl=255 time=1.12 ms



--- 10.5.5.2 ping statistics ---

3 packets transmitted, 3 received, 0% loss, time 2016ms

rtt min/avg/max/mdev = 1.129/1.298/1.403/0.124 ms




Stunnel/SSLwrap—SSL/TLS-Based "Wrapped" Tunnels and SSL Proxying/Relaying
SSL-based wrapper approaches work only for the TCP transport protocol. For example, Stunnel can encrypt TCP connections via SSL transport encryption acting as a multiplatform SSL tunneling proxy. Almost all open-source implementations are based on the OpenSSL (http://www.openssl.org) library. As mentioned at http://www.stunnel.org, "Stunnel can allow you to secure non-SSL aware daemons and protocols (like POP, IMAP, LDAP, etc) by having Stunnel provide the encryption, requiring no changes to the daemon's code."[5] SSLwrap takes a similar approach.

Secure Shell (SSH)
Although there is probably no need to introduce secure shell, I want to put it in context with our tunnel discussion. SSH uses port 21/tcp, sftp port 115/tcp, and its home base is at http://www.openssh.org. It evolved from an initial replacement for Telnet, rlogin, FTP, and rexec into a versatile and highly secure transport tunnel/relay solution with integrated strong authentication and single-sign-on capabilities. Although encrypted, the scp/sftp transfer performs extremely well. Many of OpenSSH's cryptography features rely on the OpenSSL library.

The following is a list of OpenSSH features:[6]

Open-source project

Free licensing

Strong encryption (3DES, Blowfish)

X11 forwarding (encrypt X Window System traffic)

Port forwarding (encrypted channels for legacy protocols)

Strong authentication (public key, one-time password, and Kerberos authentication)

Agent forwarding (single sign-on)

Interoperability (compliance with SSH 1.3, 1.5, and 2.0 protocol standards)

sftp client and server support in both SSH1 and SSH2 protocols

Kerberos and AFS ticket passing

Data compression

At the time of this writing, Cisco devices support only SSHv1, and there are no plans to support SSHv2 in the foreseeable future because of a focus on the IPSec architectures as a strategic platform. Cisco implements SSH server and client features and SSH terminal-line access. To figure out which Cisco IOS releases support SSH, consult Cisco.com. For example configurations, look at the Cisco.com document "Configuring Secure Shell on Routers and Switches Running Cisco IOS." SSH is straightforward to set up, but only as an integral part of authentication, authorization, and accounting (AAA).

IPSec Foundation

IPSec is a suite of protocols operating at the network layer to secure communication between IPSec peers, either client to gateway, host to host, or gateway to gateway. IPSec tunnel connections can originate from gateways (routers, firewalls), hosts, or IPSec hardware/software clients and can terminate at VPN concentrators, hosts, or gateways (routers, firewalls).

IPSec provides both authentication and encryption services. Encryption renders intercepted payload over intrinsically hostile or untrusted infrastructures useless, and authentication ensures that packets are from a legitimate peer and have not been altered in transit or maliciously injected (man-in-the-middle attacks).

Figure 11-4 demonstrates the most popular applications for IPSec. Although IPSec introduces some caveats with regard to NAT and MTU issues, it is still the approach of choice to secure IP datagram transport transparently over hostile or untrusted (shared) environments, such as the Internet per se or wireless or powerline infrastructures. A lot of work is going on right now to make IPSec more "NAT-friendly" (NAT-Traversal). For further details about current work in the IPSec area, visit the IPSec Charter of the IETF (http://www.ietf.org/html.charters/ipsec-charter.html).

NOTE

IPSec is an extension of IPv4 and a mandatory part of IPv6.



The protocol suite consists of the following major building blocks:

The IPSec security architecture for the Internet (RFC 2401)

IKE key management (RFC 2409)

ESP (RFC 2406) and AH (RFC 2402) to protect IP traffic

ISAKMP security association (SA) management (RFC 2408)

IPSec DOI for ISAKMP (RFC 2407)

The OAKLEY key determination protocol (RFC 2412)

PKI X.509v3 certificate management protocol (RFC 2510, RFC 2527)

IPSec is a complex architecture because it has to handle complex tasks. This makes the concepts difficult to grasp. It would require hundreds of pages to cover IPSec appropriately, and even more for an introduction to cryptography and PKI (Public Key Infrastructure); therefore, you are referred to the standard documents and Internet resources.

IPSec ESP/AH and Tunnel and Transport Mode
IPSec offers two services: authentication and encryption. These can be used separately, but they often are used in combination. The protocols Encapsulating Security Payload (ESP) and Authenticated Header (AH) form the heart of the IPSec architecture. They provide authenticity, integrity, and replay protection and, in the case of ESP, confidentiality (based on payload encryption). Central to the ESP and AH concept is an abstraction referred to as security association (SA), which is explained later. ESP/AH protocol information is inserted between the IP header and the payload portion of the IP datagram. This example is referred to as IPSec transport mode, protection of payload, and transport of self-originated IP datagrams. In the case of a VPN setup, IPSec tunnel mode is used. This means that IPSec gateways deliver IP datagrams on behalf of other hosts/secure network segments. In this case, the gateway adds a completely new outer transport header, and the entire original IP datagram is encrypted. ESP most often is the approach of choice because it supports authentication and encryption and has a better chance of working with NAT gateways.

Manual/Automatic Keying, Preshared Secrets, and Certificates
Manual key management is tedious, less secure (no rekeying), more error prone, and (even worse) does not scale at all. It requires pregenerated keys to be distributed securely. If no key management daemon (such as racoon or isakmpd) is running (with the added benefit of automatic rekeying), manual keys have to suffice. This also means that SA setup has to be handled manually. The following scenarios are deployed commonly:

IPSec with manual key. (IPSec secret key will not change over time.)

IPSec with IKE with preshared secret. (IPSec secret key changes over time.)

IPSec with IKE with X.509v3 certificates. (IPSec secret key changes over time, requires a PKI.)

IKE Phase 1 and 2: Main Mode and Aggressive Mode
IKE uses a two-phase process for establishing IPSec parameters between two IPSec peering nodes that would otherwise have to be configured manually (for instance, by OpenBSD ipsecadm(8)). IKE phase 1 deals with initially establishing a secure and authenticated channel (a security association = SA) between IPSec peers with either preshared keys or X.509v3 certificates to ensure that the other side is who it claims to be. This can work either in main mode or aggressive mode and forms the foundation for phase 2. That is, "main mode sends the various authentication information in a certain sequence, providing identity protection. Aggressive mode does not provide identity protection because all of the authentication information is sent at the same time."[7]

In phase 2, unidirectional endpoint SAs are negotiated on behalf of IPSec and deal with the actual key exchange necessary for data encryption. Because phase 1 has already established and verified the credentials of the peers, Quick mode suffices in phase 2.

Resolving the IKE, PKI, SA, ISAKMP, and Oakley Confusion
Internet Key Exchange (IKE) is a somewhat generic hybrid protocol that approaches the issue of negotiation and provisioning of keying material for security associations in a protected manner. It does not per se claim to be compatible with Oakley or SKEME. IKE takes into consideration client mode negotiation (negotiation proxies) independent of the actual endpoints of SAs. An SA qualitatively is a logical point-to-point security channel between two security entities (peer IP addresses).

Security associations are by their nature connection-oriented and unidirectional. From the view of IKE, an SA is nothing more than "a set of policies and key(s) used to protect information. The ISAKMP SA is the shared policy and key(s) used by the negotiating peers in this protocol to protect their communication" (quoted from RFC 2409). IKE negotiations have two phases: UDP/500 (phase 1 and phase 2).

ISAKMP provides a framework for authentication, SA management, and cryptographic key exchange, but it was designed to be intrinsically key exchange independent and thus not defining a specific key exchange. Oakley specifically describes a series of key exchanges. SKEME describes a specific, versatile key exchange technique. Oakley and SKEME are designed to be compatible with the ISAKMP framework; however, they do not form a hierarchy.

A key exchange specification essentially defines a protocol by which two already authenticated parties or peers can agree on secure and secret keying material. Public Key Infrastructure (PKI) essentially brings into play X.509v3 certificates (digital signatures), frameworks, and architectures to deal with certificates (certificate authorities [CAs], dissemination and revocation of certificates, tokens, and so on). Certificates identify organizations, sites, entities, accounts, services, and individuals. LDAP interfaces to PKI are the most common way of interfacing with other systems.

What Is Opportunistic Encryption (OE)?
You can find the basic principles of OE in context with IPSec, IKE, and DNSsec in draft-richardson-ipsec-opportunistic-12.txt (available from the http://www.ietf.org drafts archive). Linux FreeS/WAN was among the first strong supporters and contributors to this idea. The general idea is to provide a method for ad-hoc encryption for secure communication without a lot of effort for prearrangements involving the end systems/parties. The approach relies on DNS (DNS TXT resource records [RRs] in the case of FreeS/WAN) for public key distribution and can be secured via DNSsec. This requires intervention from system administrators to add ancillary DNS records for opportunistic encryption support. This approach certainly has architectural drawbacks. For further information, consult the work of the IETF IPSec and ISAKMP/Oakley Work Group and the IETF DNSEXT Work Group, where DNSsec work is done.

What Is NAT-Traversal (NAT-T)?
NAT in context with IPSec is almost always a source for trouble. Try to avoid this combination, or at least perform NAT and IPSec tunnel termination on the same box and always use ESP. See draft-ietf-ipsec-nat-reqts-04.txt for an excellent introduction as to why and in what way NAT breaks IPSec in most cases. STUN (RFC 3489) offers another solution to the NAT problem. On the plus side, tunnels in general can be the solution for NAT-ignorant protocols such as H.323 (for example, Microsoft NetMeeting).

You will find that draft-ietf-ipsec-nat-t-ike-06.txt "describes how to detect one or more Network Address Translation devices (NATs) between IPSec hosts, and how to negotiate the use of UDP encapsulation of the IPSec packets through the NAT boxes in Internet Key Exchange (IKE)." The NAT-T capability negotiation with remote gateways is done in IKE phase 1 and allows safe IPSec traversal through firewalls performing NAT. In addition, the path between the two gateways is checked for NAT presence. The negotiation of UDP-encapsulated IPSec packets is performed in IKE Quick mode.

DHCP Provisioning over IPSec Tunnel Mode
RFC 3456, "Dynamic Host Configuration Protocol (DHCPv4) Configuration of IPSec Tunnel Mode," describes a mechanism that allows remote hosts to be assigned addresses of a corporate address space. Therefore, the host would appear to be part of the intranet it securely connects to via IPSec.

IPSec Implementations
The VPNC IPSec/IKE conformance test suite uses KAME/racoon and OpenBSD's isakmpd as reference code. This should demonstrate the maturity, interoperability, and reliability of the open-source code base. It works extremely well with Cisco IPSec implementations and IPSec client software. Nevertheless, it took the IPSec vendors a long time to work out interoperability issues. Occasionally I get the impression that some vendors, for awkward commercial reasons, deliberately break what took them years to fix. This is an especially big problem with IPSec intervendor client-to-gateway interoperability. (You are invited to draw your own conclusion.)

Linux IPSec
Until recently, Linux FreeS/WAN (http://www.freeswan.org) was the most popular implementation of IPSec and IKE for the Linux 2.2/2.4 kernel (IPv4 only). A related project called Super FreeS/WAN (http://www.freeswan.ca) included all the latest-and-greatest patches and early development features (NAT-Traversal, AES, X.509, ALG [all ciphers/hashes as modules], Dead Peer Detection IETF Draft, and so on). Because of disagreements about the evolution of FreeS/WAN and some peculiar points of view (removal of AH, focus on opportunistic encryption, and lack of interest in IPSec standard compliance and interoperability), the project has been discontinued and is no longer actively maintained.

The OpenSWAN Project (http://www.openswan.org) has started as a code fork of FreeS/WAN and will continue the work. The FreeS/WAN maintainer had a strategic interest in pushing a new approach to IPSec tunnel/VPN provisioning referred to as "opportunistic encryption" involving advanced DNS features, plug-and-play friendliness at the cost of IPSec generic compliance, and reduced security. It escaped the attention of some people that FreeS/WAN gateways do not necessarily talk only to FreeS/WAN gateways. This led to a misjudgment of the community support of that strategic direction.

OpenSWAN is a huge kernel patch and module with accompanying user-space tools that never made it into the mainstream kernel. KLIPS is the kernel IPSec module, and pluto is the IKE daemon. The new 2.6 Linux kernel drastically changed this picture. The current state of affairs is this: "As of Linux 2.5.47, there is a native IPSec implementation in the kernel. It was written by Alexey Kuznetsov and Dave Miller, inspired by the work of the USAGI IPv6 group. With its merge, James Morris' CrypoAPI also became part of the kernel—it does the actual crypting. As of 2.5.49, IPSec works without further patches."[8]

Linux native IPSec for the new 2.6 Linux kernel is based on the KAME Project's IKE daemon racoon, which is a big leap forward for consistent IPSec interoperability between BSD platforms and Linux. OpenBSD's isakmpd also has been ported to Linux, and OpenSWAN is completing 2.6 integration support of their own implementation. OpenSWAN is easy to install; just follow the ReadMe that comes with the sources. IPSec-Tools is a port of KAME's IPSec utilities to the Linux 2.6 including racoon/setkey. isakmpd and racoon/setkey can be retrieved from the following resources:

http://bender.thinknerd.de/~thomas/IPsec/isakmpd-linux.html

http://ipsec-tools.sourceforge.net/

KAME
The KAME Project is a software kit that provides reference implementations of IPv6 and IPSec (both IPv4/IPv6) for BSD operating systems as well as the alternate queuing framework (ALTQ) discussed in Chapter 13, "Policy Routing, Bandwidth Management, and QoS." KAME's IKE daemon is called racoon.

During IPSec setup, the kernel needs to know what traffic to encrypt or secure and how. This is referred to as establishing an IPSec security policy. On BSD systems, this information is stored in a table in the kernel known as the security policy database (SPD).

The setkey(8) utility is the tool to manipulate the SPD. Another table (the security association database [SAD]) stores the various encryption keys needed to secure communications between hosts, clients, and gateways. In case of manual keying, the setkey(8) program also is used to configure the manual keys in the SAD. With an IKE approach, racoon will handle the adding and deleting of entries from the SAD automatically.

FreeBSD
To add IPSec support to your FreeBSD kernel, add the code in Example 11-14 to your kernel config file, and then recompile and install the new kernel. You essentially need the two utilities setkey and the IKE daemon racoon.

Example 11-14. FreeBSD IPSec Kernel Configuration Options

options IPSEC #IP security

options IPSEC_ESP #IP security

options IPSEC_DEBUG #debug for IP security

device gif 4 #For IPSec Tunnel Mode




FreeBSD IPSec configuration includes the following steps:

Retrieve and install the racoon daemon from ports by using cd /usr/ports/security/racoon followed by make all, make install, make clean.


Define the IPSec security policy via setkey -DFP (for manual policy management) and setkey -f /etc/ipsec.conf.


You also can do that dynamically via the IKE daemon racoon. It requires two configuration files: /usr/local/etc/racoon/psk.txt (for preshared keys) and /usr/local/etc/racoon/racoon.conf.


Then start racoon via racoon -l /var/log/racoon -f usr/local/etc/racoon/racoon.conf.


NOTE

IPSec tunnel connections between two FreeBSD gateways require the configuration of the gif pseudo-interface for proper routing between the protected private (RFC 1918) networks behind these gateways (Example 11-15).



Example 11-15. Castor gif Pseudo-Interface Setup

[root@castor:~#] gifconfig gif0 192.168.2.7 192.168.2.254

[root@castor:~#] ifconfig gif0 inet 192.168.7.7 netmask 255.255.255.0 192.168.45.254

netmask 255.255.255.0



[root@castor:~#] gifconfig gif0

[gif0: flags=8051 mtu 1280

inet6 fe80::210:5aff:fec4:2c04%gif0 prefixlen 64

inet 192.168.7.7 --> 192.168.45.254 netmask 0xffffff00

physical address inet 192.168.2.7 --> 192.168.2.254



[root@castor:~#] netstat -rn -f inet

Routing tables



Internet:

Destination Gateway Flags Refs Use Netif Expire

default 192.168.2.254 UGSc 3 121 xl0

10.0.0.4 10.0.0.4 UH 0 0 lo0

127.0.0.1 127.0.0.1 UH 1 32 lo0

192.168.2 link#1 UC 2 0 xl0

192.168.2.7 00:10:5a:c4:2c:04 UHLW 3 4 lo0

192.168.2.254 52:54:05:e3:e4:2f UHLW 5 446 xl0 402

192.168.7 link#2 UC 0 0 ed0

192.168.45.254 192.168.7.7 UH 0 0 gif0

192.168.80 link#15 UC 0 0 vlan8




NOTE

Consult http://www.freebsd.org/doc/en_USISO88591/books/handbook/ipsec.html for further details.



OpenBSD
isakmpd is the OpenBSD ISAKMP/Oakley (a.k.a. IKE) key management daemon. The isakmpd daemon is responsible for the establishment of management of security associations for encrypted or authenticated network traffic. It is the only scalable alternative to manual keying with tedious and error-prone manual SA setups and ESP/AH flows on top. isakmpd is also available for NetBSD. There you have the luxury to choose between isakmpd and racoon. Example 11-16 shows the kernel configuration options required by OpenBSD and related sysctl parameters.

Example 11-16. OpenBSD IPSec Kernel Configuration Options

### kernel config:



option CRYPTO # Cryptographic Framework

option IPSEC # IPSec VPN

#option KEY # KEY implied by IPSec

pseudo-device enc 4 # Encapsulation device used by IPSec



### sysctl:



[root@ganymed:~#] sysctl -w net.inet.esp.enable=1

[root@ganymed:~#] sysctl -w net.inet.ah.enable=1

[root@ganymed:~#] sysctl -w net.inet.ip.forwarding=1

[root@ganymed:~#] sysctl -w net.inet6.ip6.forwarding=1

[root@ganymed:~#] sysctl -w net.inet.ipcomp.enable = 1




An OpenBSD IPSec setup consists of these components:

/etc/rc.vpn (for manual keying only, manual SAs, and IPSec flows)

/etc/isamkmpd/isakmpd.conf

/etc/isamkmpd/isakmpd.policy

isakmpd (not required for manual keying)

The keynote utility (optional, man pages 1, 3, 4, 5; RFC 2704), public/private key generation, and trust management

ipsecadm (generic admin interface for manual setup)

The enc(4) pseudo-interface for encryption (adjust your firewall filters accordingly)

NOTE

photurisd is an alternative key management daemon for OpenBSD. It is based on RFC 2522 and RFC 2523. A word of wisdom: Stay away from the OpenBSD photurisd. It has major limitations, and the whole community is using ISAKMP anyway. photurisd was removed from the OpenBSD tree with version 3.3 for good reason and can be considered deprecated.

Advice About IPSec Lab Scenarios

Host-to-host security hardly is used anymore today, and the same is true for manual IPSec keying and manual SA setup. IKE dominates the picture with rapid acceptance of X.509v3 certificate integration. The most widespread deployments of IPSec feature gateway-to-gateway and road-warrior-to-gateway configurations. VPN client software is required on the road warrior (PDA, notebook).

Because OpenSWAN and native kernel IPSec for 2.6 kernels is rapidly approaching its final stage of consolidation, we will wait until the dust settles and focus on FreeBSD and OpenBSD IKE here. Dynamically negotiated IPSec requires configuration of the IKE daemons and a policy that defines qualified traffic that triggers SA establishment (for example, network to network via tunnel mode).

Lab 11-8: An IPSec with IKE (racoon/isakmpd) Scenario (Gateway-to-Gateway Tunnel Mode)
In this lab, we require the discussed gif tunnel setup on the FreeBSD side. Example 11-17 demonstrates the setup and output of the IPSec gateway ganymed (OpenBSD), and Example 11-18 shows the configuration of the IPSec peer castor (FreeBSD). FreeBSD has a dedicated configuration file for the IPSec policy, and OpenBSD isakmpd contains everything in a single configuration file. The tunnel operation is verified via extended pings from castor and callisto in combination with sniffer traces. The highlighted text emphasizes successful SA establishment.

Example 11-17. OpenBSD IPSec with ISAKMPD and Preshared Key

[root@ganymed:/etc/isakmpd#] cat isakmpd.policy

KeyNote-Version: 2

Authorizer: "POLICY"

Licensees: "passphrase:cisco"

Conditions: app_domain == "IPsec policy" &&

esp_present == "yes" &&

esp_enc_alg == "3des" &&

esp_auth_alg == "hmac-md5" -> "true";



[root@ganymed:/etc/isakmpd#] cat isakmpd.conf

#

# A configuration sample VPN for the isakmpd ISAKMP/Oakley (a.k.a. IKE) daemon.

# "ganymed" and "castor" are the respective security gateways (a.k.a. VPN nodes).

#

[General]

Retransmits= 5

Exchange-max-time= 120

Listen-on= 192.168.2.254



[Phase 1]

192.168.2.7= ISAKMP-peer-castor



[Phase 2]

Connections= IPsec-ganymed-castor



[ISAKMP-peer-castor]

Phase= 1

Transport= udp

Local-address= 192.168.2.254

Address= 192.168.2.7

Authentication= cisco

Configuration= Default-main-mode



[IPsec-ganymed-castor]

Phase= 2

ISAKMP-peer= ISAKMP-peer-castor

Configuration= Default-quick-mode

Local-ID= Net-ganymed

Remote-ID= Net-castor



[Net-ganymed]

ID-type= IPV4_ADDR_SUBNET

Network= 192.168.45.0

Netmask= 255.255.255.0



[Net-castor]

ID-type= IPV4_ADDR_SUBNET

Network= 192.168.7.0

Netmask= 255.255.255.0



[Default-main-mode]

EXCHANGE_TYPE= ID_PROT

Transforms= 3DES-MD5-GRP2



[Default-quick-mode]

DOI= IPSEC

EXCHANGE_TYPE= QUICK_MODE

Suites= QM-ESP-3DES-MD5-PFS-GRP2-SUITE



### Proof of the two uni-directional SAs ###



[root@ganymed:~#] cat /kern/ipsec

Hashmask: 31, policy entries: 2

SPI = 0ea713d5, Destination = 192.168.2.7, Sproto = 50

Established 416 seconds ago

Source = 192.168.2.254

Flags (00011082) =

Crypto ID: 1

xform =

Encryption = <3DES>

Authentication =

3528 bytes processed by this SA

Last used 378 seconds ago

Expirations:

Hard expiration(1) in 784 seconds

Soft expiration(1) in 664 seconds



SPI = b6297e4e, Destination = 192.168.2.254, Sproto = 50

Established 416 seconds ago

Source = 192.168.2.7

Flags (00001082) =

Crypto ID: 2

xform =

Encryption = <3DES>

Authentication =

3696 bytes processed by this SA

Last used 378 seconds ago

Expirations:

Hard expiration(1) in 784 seconds

Soft expiration(1) in 664 seconds



### The encap routing situation as derived from the VPN policy setup

(isakmpd.policy) ###



[root@ganymed:~#] netstat -f encap -rn

Routing tables



Encap:

Source Port Destination Port Proto SA(Address/Proto/Type/Direction)

192.168.7/24 0 192.168.45/24 0 0 192.168.2.7/50/use/in

192.168.45/24 0 192.168.7/24 0 0 192.168.2.7/50/require/out



### Detailed Protocol Statistics for ESP/AH ###



[root@ganymed:~#] netstat -p esp

esp:

42 input ESP packets

42 output ESP packets

0 packets from unsupported protocol families

0 packets shorter than header shows

0 packets dropped due to policy

0 packets for which no TDB was found

0 input packets that failed to be processed

0 packets with bad encryption received

0 packets that failed verification received

0 packets for which no XFORM was set in TDB received

0 packets were dropped due to full output queue

0 packets where counter wrapping was detected

0 possibly replayed packets received

0 packets with bad payload size or padding received

0 packets attempted to use an invalid tdb

0 packets got larger than max IP packet size

0 packets that failed crypto processing

3696 input bytes

3528 output bytes



[root@ganymed:~#] netstat -p ah

ah:

0 input AH packets

0 output AH packets

0 packets from unsupported protocol families

0 packets shorter than header shows

0 packets dropped due to policy

0 packets for which no TDB was found

0 input packets that failed to be processed

0 packets that failed verification received

0 packets for which no XFORM was set in TDB received

0 packets were dropped due to full output queue

0 packets where counter wrapping was detected

0 possibly replayed packets received

0 packets with bad authenticator length received

0 packets attempted to use an invalid tdb

0 packets got larger than max IP packet size

0 packets that failed crypto processing

0 input bytes

0 output bytes



### And the sniffer traces to prove that we are really encrypting ###



[root@castor:~#] ping -S 192.168.7.7 192.168.45.1

PING 192.168.45.1 (192.168.45.1) from 192.168.7.7: 56 data bytes

64 bytes from 192.168.45.1: icmp_seq=0 ttl=63 time=2.412 ms

64 bytes from 192.168.45.1: icmp_seq=1 ttl=63 time=2.382 ms

64 bytes from 192.168.45.1: icmp_seq=2 ttl=63 time=2.320 ms

^C

--- 192.168.45.1 ping statistics ---

3 packets transmitted, 3 packets received, 0% packet loss

round-trip min/avg/max/stddev = 2.320/2.371/2.412/0.038 ms



[root@callisto:~#] ping -I 192.168.45.1 192.168.7.7

PING 192.168.7.7 (192.168.7.7) from 192.168.45.1 : 56(84) bytes of data.

64 bytes from 192.168.7.7: icmp_seq=1 ttl=63 time=3.84 ms

64 bytes from 192.168.7.7: icmp_seq=2 ttl=63 time=2.64 ms

64 bytes from 192.168.7.7: icmp_seq=3 ttl=63 time=2.51 ms



--- 192.168.7.7 ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 2018ms

rtt min/avg/max/mdev = 2.515/3.002/3.846/0.600 ms



[root@ganymed:~#] tethereal -i ne4

Capturing on ne4

0.000000 castor.nerdzone.org -> 192.168.2.254 ESP ESP (SPI=0x2b76d234)

0.001213 192.168.2.254 -> castor.nerdzone.org ESP ESP (SPI=0x01a960cc)

0.272924 192.168.2.254 -> castor.nerdzone.org ESP ESP (SPI=0x01a960cc)

0.273586 castor.nerdzone.org -> 192.168.2.254 ESP ESP (SPI=0x2b76d234)

1.001848 castor.nerdzone.org -> 192.168.2.254 ESP ESP (SPI=0x2b76d234)

1.003015 192.168.2.254 -> castor.nerdzone.org ESP ESP (SPI=0x01a960cc)

1.282909 192.168.2.254 -> castor.nerdzone.org ESP ESP (SPI=0x01a960cc)

1.283591 castor.nerdzone.org -> 192.168.2.254 ESP ESP (SPI=0x2b76d234)



[root@ganymed:~#] tethereal -i enc0

Capturing on enc0

0.000000 -> UNKNOWN WTAP_ENCAP = 0

0.001566 -> UNKNOWN WTAP_ENCAP = 0

0.668721 -> UNKNOWN WTAP_ENCAP = 0

0.669053 -> UNKNOWN WTAP_ENCAP = 0

1.009968 -> UNKNOWN WTAP_ENCAP = 0

1.011561 -> UNKNOWN WTAP_ENCAP = 0

1.670448 -> UNKNOWN WTAP_ENCAP = 0

1.670744 -> UNKNOWN WTAP_ENCAP = 0




Example 11-18. FreeBSD IPSec with racoon and Preshared Key

### gif tunnel setup for routing ###



[root@castor:~#] gifconfig gif0 192.168.2.7 192.168.2.254



[root@castor:~#] ifconfig gif0 inet 192.168.7.7 netmask 255.255.255.0 192.168.45.254

netmask 255.255.255.0



[root@castor:~#] gifconfig gif0

[gif0: flags=8051 mtu 1280

inet6 fe80::210:5aff:fec4:2c04%gif0 prefixlen 64

inet 192.168.7.7 --> 192.168.45.254 netmask 0xffffff00

physical address inet 192.168.2.7 --> 192.168.2.254



[root@castor:~#] netstat -rn -f inet

Routing tables



Internet:

Destination Gateway Flags Refs Use Netif Expire

default 192.168.2.254 UGSc 3 121 xl0

10.0.0.4 10.0.0.4 UH 0 0 lo0

127.0.0.1 127.0.0.1 UH 1 32 lo0

192.168.2 link#1 UC 2 0 xl0

192.168.2.7 00:10:5a:c4:2c:04 UHLW 3 4 lo0

192.168.2.254 52:54:05:e3:e4:2f UHLW 5 446 xl0 402

192.168.7 link#2 UC 0 0 ed0

192.168.45.254 192.168.7.7 UH 0 0 gif0

192.168.80 link#15 UC 0 0 vlan8



### IPsec configurations ###



[root@castor:~#] cat /etc/ipsec.conf

spdadd 192.168.7.0/24 192.168.45.0/24 any -P out ipsec

esp/tunnel/192.168.2.7-192.168.2.254/require;

spdadd 192.168.45.0/24 192.168.7.0/24 any -P in ipsec

esp/tunnel/192.168.2.254-192.168.2.7/require;



[root@castor:~#] cat /usr/local/etc/racoon/psk.txt

# IPv4/v6 addresses

192.168.2.254 cisco



[root@castor:~#] cat /usr/local/etc/racoon/racoon.conf



path include "/usr/local/etc/racoon" ;



# search this file for pre_shared_key with various ID key.

path pre_shared_key "/usr/local/etc/racoon/psk.txt" ;



# racoon will look for certificate file in the directory,

# if the certificate/certificate request payload is received.

path certificate "/usr/local/etc/cert" ;



# "log" specifies logging level. It is followed by either "notify," "debug,"

# or "debug2."

#log debug;



# "padding" defines some parameter of padding. You should not touch these.

padding

{

maximum_length 20; # maximum padding length.

randomize off; # enable randomize length.

strict_check off; # enable strict check.

exclusive_tail off; # extract last one octet.

}



# if no listen directive is specified, racoon will listen to all

# available interface addresses.

listen

{

isakmp 192.168.2.7 [500];

#admin [7002]; # administrative port by kmpstat.

strict_address; # all addresses must be bound.

}



# Specification of various default timers.

timer

{

# These value can be changed per remote node.

counter 5; # maximum trying count to send.

interval 20 sec; # maximum interval to resend.

persend 1; # the number of packets per a send.



# timer for waiting to complete each phase.

phase1 30 sec;

phase2 15 sec;

}



### gateway-to-gateway ###



remote 192.168.2.254

{

exchange_mode main,aggressive;

doi ipsec_doi;

situation identity_only;



my_identifier address 192.168.2.7;

peers_identifier address 192.168.2.254;



nonce_size 16;

lifetime time 1 min; # sec,min,hour



proposal {

encryption_algorithm 3des;

hash_algorithm md5;

authentication_method pre_shared_key ;

dh_group 2 ;

}

}



sainfo address 192.168.2.7 any address 192.168.2.254 any

{

pfs_group 2 ;

lifetime time 30 sec;

encryption_algorithm 3des ;

authentication_algorithm hmac_md5;

compression_algorithm deflate ;

}



[root@castor:~#] cat /var/log/racoon

2004-04-04 13:44:36: INFO: main.c:174:main(): @(#)internal version 20001216 sakane@kame.net

2004-04-04 13:44:36: INFO: main.c:175:main(): @(#)This product linked OpenSSL 0.9.7c 30

Sep 2003 (http://www.openssl.org/)

2004-04-04 13:44:36: INFO: isakmp.c:1358:isakmp_open(): 192.168.2.7[500] used as isakmp

port (fd=5)

2004-04-04 13:44:51: INFO: isakmp.c:894:isakmp_ph1begin_r(): respond new phase 1

negotiation: 192.168.2.7[500]<=>192.168.2.254[500]

2004-04-04 13:44:51: INFO: isakmp.c:899:isakmp_ph1begin_r(): begin Identity Protection mode.

2004-04-04 13:44:51: WARNING: isakmp_inf.c:1281:isakmp_check_notify(): ignore

INITIAL-CONTACT notification, because it is only accepted after phase1.

2004-04-04 13:44:51: WARNING: ipsec_doi.c:3099:ipsecdoi_checkid1(): ID value mismatched.

2004-04-04 13:44:51: INFO: isakmp.c:2412:log_ph1established(): ISAKMP-SA established 192

.168.2.7[500]-192.168.2.254[500] spi:1340537a78e1b7d8

:d25809b27e1f5e75

2004-04-04 13:44:52: INFO: isakmp.c:1049:isakmp_ph2begin_r(): respond new phase 2

negotiation: 192.168.2.7[0]<=>192.168.2.254[0]

2004-04-04 13:44:52: INFO: pfkey.c:1134:pk_recvupdate(): IPsec-SA established: ESP/Tunnel

192.168.2.254->192.168.2.7 spi=245830613(0xea713d5)

2004-04-04 13:44:52: INFO: pfkey.c:1357:pk_recvadd(): IPsec-SA established: ESP/Tunnel 192

.168.2.7->192.168.2.254 spi=3056172622(0xb6297e4e)

2004-04-04 13:45:51: INFO: isakmp.c:1516:isakmp_ph1expire(): ISAKMP-SA expired 192.168.2

.7[500]-192.168.2.254[500] spi:1340537a78e1b7d8:d2580

9b27e1f5e75

2004-04-04 13:45:52: INFO: isakmp.c:1564:isakmp_ph1delete(): ISAKMP-SA deleted 192.168.2

.7[500]-192.168.2.254[500] spi:1340537a78e1b7d8:d2580

9b27e1f5e75

Designing for High Availability

High-availability architectures represent a wide-ranging subject of interlocked complexity stretching over all layers of the OSI (Open System Interconnection) stack.

Keep in mind that the end-user's perception of service availability is the ultimate and most relevant criterion; perception will be favorable if you did your job right. Toward that end, high-availability architectures satisfy the following needs:

Redundancy— This includes equipment (node) and topology (link) redundancy precautions and redundant services available for a user base.

Load balancing— Naturally, load balancing primarily serves the purpose of distributing load among candidates of a pool or farm of devices. Next-hop redundancy considerations and load balancing are important aspects of such an overall design. Dynamic DNS can accomplish this also with different means.

Clustering— This involves logical grouping of constituents to a service. Clustering groups might include performance clusters, load-balancing clusters, or fault-tolerance clusters. It is another generic approach to presenting one highly robust virtual service to the outside world with a group of real servers behind the scene. Dedicated cluster management software maintains the overall picture of cluster controllers and component servers, thus increasing overall availability, robustness, and performance.

Heartbeat/keepalives— Heartbeat/keepalive protocols and agents monitor the availability and operational parameters of network elements and services.

(D)DoS defenses— Robust high-availability architectures can more likely withstand or mitigate the effects of (D)DoS attacks or are an attribute of a sound design.

Network failover strategies— These approaches in general include VRRP/HSRP mechanisms in combination with gratuitous ARP for the purpose of providing a gateway failover mechanism.

Reliable failure detection and fast recovery/restoration of service— This is the domain of routing protocols. The general goal of modern routing designs is subsecond convergence. This is a mandatory requirement for real-time traffic such as voice or video.

This chapter discusses support for such services from a networker's point of view (OSI Layers 1 through 4). The application layers (Layers 5 through 7) are intentionally underrepresented in this chapter because they use other mechanisms beyond the scope of a network/transport layer discussion.
Increasing Availability
The essential questions for high-availability (HA) designers have always been (and will continue to be) "How can I increase the overall availability of a special service or application, and what do I have to do to eliminate weak links in the chain or single points of failure? Tackling these challenges involves thorough planning across all OSI layers and the removal of all single points of failure wherever possible. A chain is as strong as its weakest link. Therefore, it is highly advisable to have at least one backup system, link, or resource available at all times.

Of course, the efforts and costs associated with such an endeavor can get out of hand easily and should, therefore, be governed by common sense and commercial feasibility. This is a particularly interesting topic in times of "best effort" services. Best effort is always a commercial dictate. The particular task of network engineers is to provide highly robust IP infrastructures to support higher-layer redundancy approaches, and the task of systems engineers is to accomplish OS resilience with concepts such as clustering or distributed architectures. This is the foundation for high-availability applications (services); a good implementation should result in robust and stable services from the point of view of the end user. How this is accomplished means little to the customer.

Withstanding a (D)DoS Attack

In light of recent Internet attacks, whether a sound HA architecture should withstand a massive (distributed) denial-of-service ([D]DoS) attack or be able to mitigate its effects has become a legitimate question. From my point of view, a state-of-the-art HA architecture should have some inherent self-healing capabilities; HA architects should also add another line of defense to assist in at least crippling or weakening (D)DoS attacks and their progeny. Several, sometimes complementary and orthogonal, lines of defense are crucial to prevent (D)DoS attacks, as they are to overall security architectures.

HA in terms of almost 100 percent service availability within strict service level agreements (SLAs) and monitored key performance indicators (KPIs) represents a significant challenge for today's finest engineers and designers. The problem with any (D)DoS defense is that every system's strength defines its weaknesses, too. For example, handing over control of a firewall ruleset to a network intrusion detection system (NIDS) means that any successful trigger of this defense mechanism (spoofing) effectively locks out legitimate networks from crucial services. Therefore, a system designed to protect or prevent might become the perfect DoS trap.

NOTE

Recent hostile activities on the Internet have proven to me that, in general, operational staff are overwhelmed by and overburdened with reactive actions because of weak underlying network design and planning.

Network HA Approaches
The fundamental principle, and the foundation of network HA, is network link redundancy and redundant hardware (network elements).

Redundant Paths
The underlying design principle is that, for a critical service, at least two equivalent systems should be provided and topologies chosen in a way that there always exist, at the least, two redundant paths to the next device. This is why for so many years many robust and scalable photonic network approaches have been based successfully on protected ring topologies (for example, Synchronous Digital Hierarchy/Synchronous Optical Network [SDH/SONET]) and Resilient Packet Ring (RPR). Just because a lot of folks disliked Token Ring technology for no apparent reason does not mean that ring topologies per se are inferior to bus architectures or star topologies; on the contrary. With a small number of network elements, point-to-point links will suffice. Usually a collapsed network core consists of three or four network elements (as shown in
My approach to network redundancy is that more than one alternative link is unnecessary and unjustifiable commercially.

Standby Equipment
Another concept is the provisioning of cold- and hot-standby equipment, meaning components that need power up and hardware configuration (versus up-and-running failover candidates). Occasionally, engineers or management throw hardware resources at a simple design problem. However, HA concepts that are too exhaustive add considerable complexity to networks, occasionally defeating the purpose (and at unjustifiable expense).

As an introduction to the challenge of HA, Figure 12-2 presents a typical corporate Internet connectivity example in two variants.

Simple but Effective Approaches to Server HA

Let us consider the network vicinity of a server in the context of its connected network interface cards (NICs), its LAN switch environment, VLAN membership, and exit gateways. Note that two or more NICs attached to redundant switch access ports provide sufficient redundancy, and channel bonding or interface teaming provides another useful combination of link aggregation (with an added redundancy benefit).

Route equalizing per destination or per packet can be configured to exit the two VLAN broadcast domains to which a server is usually hooked up. Beyond VLANs, dynamic routing protocols provide sufficiently fast rerouting around failures. It is fairly straightforward to provide redundant VLAN trunks and trunk termination (redundant routers on a stick) via Virtual Router Redundancy Protocol (VRRP) or Hot Standby Router Protocol (HSRP). This can be combined with equalized default routes (Linux) or floating static route concepts. Manual load distribution can be manipulated via manually tuned more-specific prefix routes. Return-packet load balancing originating from distant sites is an entirely different story; Domain Name System round-robin (DNS RR), Border Gateway Protocol (BGP) approaches (MED or path prepending), or dedicated load-balancing devices represent possible solutions.

When experimenting with special load-distribution approaches, keep in mind that Internet Control Message Protocol (ICMP) redirects might affect what you try to accomplish. sysctl provides a hook to disable dissemination of ICMP redirect messages (as shown in Example 12-1).

Example 12-1. Disabling ICMP Redirects for Special Cases

[root@ganymed:~#] sysctl -a | grep redirect

net.inet.ip.redirect = 1

net.inet6.ip6.redirect = 1
Address Resolution Protocol (ARP) cache latency is another issue that considerably affects certain setups. How long an ARP entry remains in a cache until it is removed is implementation-specific and might require manual intervention. To compensate for long timeouts, failover concepts such as VRRP/HSRP use gratuitous ARP featuring unsolicited updates.

Split-view DNS setups are popular, especially in enterprise networks where Network Address Translation (NAT) is used. Split-view DNS essentially means that an internal name server responds to queries for names associated with corporate RFC 1918 addresses and consults the external name server if it fails to resolve global records. Therefore, for true redundancy, two internal and two external DNS servers are advisable.

Traffic Shaping, Queuing, Reservation, and Scheduling

Queuing works only for packets in the outbound (egress) direction. The only viable way to improve this situation is to enable bidirectional queuing on adjacent routers—for example, by configuring committed access rate (CAR)/rate limits on Cisco IOS architecture. Adjacency essentially means connected via point-to-point links or Ethernet crossover links. When no other queuing regimes are activated, almost all stack implementations resort to default first-in/first-out (FIFO) behavior.

The actual tasks involved in traffic shaping and implementing QoS include reserving resources, buffering, and scheduling behind the scenes. The choice of a queuing discipline is tricky, depending on the load on a link, and requires a thorough understanding of the internal workings of the queuing mechanism.

Queuing disciplines are a classical area of academic and applied research and go beyond the scope of this book. They are essentially procedures or measures that influence the way data is sent, delayed, and queued. You will find excellent resources for further information about queuing in the "Recommended Reading" section at the end of this chapter.

Queuing disciplines essentially come in two flavors: classless queuing disciplines (no subdivision granularity; reschedule, delay, or drop on a flat scale) and classful (class-context) queuing disciplines. The most popular queuing regimes are as follows:

  • CBQ— Class-based queuing

  • RED— Random early detection

  • WFQ— Weighted fair queuing

  • PRIQ— Priority queuing

Permanently saturated links require other strategies than bursty traffic patterns. Nothing really prevents permanently overburdened queues and interface buffers from dropping datagrams/frames. Proactively dealing with that problem is the art of congestion avoidance/management. Queuing is an integral part of the IP stack and forwarding engine and, therefore, the responsibility of the kernel. User-space utilities for administration complement the implementations. Shaping serves two purposes: limiting available bandwidth, and smoothing the use of virtual pipes.

Traffic conditioning is the art of dealing with incoming (ingress) traffic via a policer or shaper. A policer just enforces a rate limit, whereas a shaper smoothes the traffic flow to a specified rate by the use of buffers. Standard mechanisms of the Cisco IOS architecture are CAR, generic traffic shaping (GTS), and Frame Relay traffic shaping (FRTS).

Layer 3 QoS: IP ToS, Precedence, CoS, IntServ, and DiffServ Codepoints

QoS definitions vary by service and approach chosen. For data communication networks, typical QoS characteristics and metrics include bandwidth, delay (latency), delay variation (jitter), and reliability, as follows:

  • Bandwidth— Peak data rate (PDR), sustained data rate (SDR), minimum data rate (MDR).

  • Delay/latency— End-to-end or round-trip delay, delay variation (jitter), node-processing delay.

  • Reliability— Availability (as percent of uptime), mean time between failures/mean time to repair (MTBF/MTTR), errors, and packet loss.

The IP header contains a Type of Service (ToS) field (see Example 13-12). Applications can set the three precedence bits of this ToS field at the network interface card (NIC) level according to their requirements.

Example 13-12. IPv4 Header with ToS Field
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Version | IHL | Type of Service | Total Length |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Identification | Flags | Fragment Offset |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Time to Live | Protocol | Header Checksum |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Source Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Destination Address |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

| Options | Padding |

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


In the context of IP QoS considerations, a 3-bit field in the ToS byte of the IP header is referred to as precedence (see Example 13-13). Using IP precedence, a network administrator can assign values from 0 (the default) to 7 to classify and prioritize types of traffic.

Example 13-13. ToS and Precedence
       0     1     2     3     4     5     6     7

+-----+-----+-----+-----+-----+-----+-----+-----+

| | | | | |

| PRECEDENCE | STRM|RELIABILITY| S/R |SPEED|

| | | | | |

+-----+-----+-----+-----+-----+-----+-----+-----+


Many applications and routers support IP precedence. The ToS and differentiated services (DiffServ) approach directly tag the traffic itself, which therefore contains in-band QoS markings. An out-band approach is the Resource Reservation Protocol (RSVP). An integrated services (IntServ) approach provides end-to-end QoS in IP networks and relies on per-flow state information and integration with RSVP as a signaling protocol at every involved hop. (IntServ is considered to have some weaknesses.)

DiffServ takes a simpler approach with less signaling overhead and no QoS-aware intermediate network nodes for the entire path. Packets are classified and marked to receive a particular per-hop forwarding behavior on nodes along their path (RFC 2475). The DiffServ (DS) field is supposed to succeed the IPv4 ToS field in the IPv4 header, which is deprecated and in IPv6 context "rejuvenated" as the traffic-class octet (see Example 13-14).

NOTE

For DiffServ internals, see RFC 2474, "Definition of Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers."


Example 13-14. DiffServ Codepoints
The DS field structure is presented below (RFC 2474):



0 1 2 3 4 5 6 7

+---+---+---+---+---+---+---+---+

| DSCP | CU |

+---+---+---+---+---+---+---+---+



DSCP: Differentiated services codepoint

CU: Currently unused (reserved)


Note that when you are dealing with DiffServ, two expressions are used frequently: PHB (per-hop behavior) and DSCP (DiffServ codepoint). In current architectures, IP precedence values are mapped into DSCPs

802.1P/Q Tagging/Priority—QoS at the Data-Link/MAC Sublayer

802.1P provides for eight traffic classes drawn from priority fields in 802.1Q VLAN tags. The IEEE 802.1P standard describes important methods for providing QoS at the MAC level and defines traffic-class expediting (3 bits) and dynamic-multicast filtering to ensure traffic does not traverse the boundaries of Layer 2-switched networks.

NOTE

Both 802.1P and 802.1Q are part of 802.1D.


Most vendors support 802.1P/Q in their Layer 2/3 equipment and modern NICs. This means that QoS tagging is pushed out to the network edge down to the NIC level. However, privileged treatment of these frames still is best effort in Layer 2-switched networks and does not involve reservation setup. The 3 priority bits can be mapped easily into the Layer 3 IP precedence bits or a subset of DSCPs. Therefore, we have coherent tagging, which is easy to implement. The remaining question—and there exists no uniform approach—is how to implement queuing for these priority flows at Layer 2 and Layer 3.

There is no 802.1P without 802.1Q VLAN tagging. The VLAN tag carries VLAN information—the VLAN ID (12 bits) and prioritization (3 bits). The Prioritization field was never defined in the VLAN standard, so 802.1P steps in and actually brings it to life. This effort defines a 32-bit tag header that is inserted after a frame's normal destination and source address header info. Switches, routers, servers, and even desktop systems can set these priority bits.

802.1Q priority is supported only rudimentary on UNIX. Linux vconfig can set these bits (see Example 13-15). Whether this works depends on the 802.1Q VLAN implementation of the OS.

Example 13-15. 802.1Q Priority Setting on Linux
[root@callisto:~#] vconfig add eth0 1

[root@callisto:~#] vconfig set_egress_map eth0.1 8

[root@callisto:~#] ifconfig –a

...

eth0.1 Link encap:Ethernet HWaddr 00:10:5A:D7:93:60

BROADCAST MULTICAST MTU:1500 Metric:1

RX packets:0 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

...

[root@callisto:~#] cat /proc/net/vlan/eth0.1

eth0.1 VID: 1 REORDER_HDR: 1 dev->priv_flags: 1

total frames received: 0

total bytes received: 0

Broadcast/Multicast Rcvd: 0

total frames transmitted: 0

total bytes transmitted: 0

total headroom inc: 0

total encap on xmit: 0

Device: eth0

INGRESS priority mappings: 0:0 1:0 2:0 3:0 4:0 5:0 6:0 7:0

EGRESSS priority Mappings: 8:0

DiffServ and RSVP/RSVP-TE Implementations for UNIX

It appears that the most active work in this area is done in the context of integrating DiffServ, RSVP-TE, Open Shortest Path First traffic engineering (OSPF-TE), and MPLS/LDP implementations, mostly on Linux platforms. The main Linux DiffServ resource is http://diffserv.sourceforge.net/. I am aware of two RSVP packages available at http://www.isi.edu/div7/rsvp/rsvp.html and http://www.kom.e-technik.tu-darmstadt.de/rsvp/.

Cisco IOS QoS and Queuing Architectures

The Cisco QoS architecture has evolved quite significantly over time with a strong foundation in (distributed [D]) CAR, (CB) WFQ, PRIQ, custom queuing, WRED, and the new D-WRED. It has evolved into a complete architecture that incorporates the capabilities of Frame Relay (discard eligibility [DE]) and ATM (cell loss priority [CLP]); IP to ATM CoS; in addition to 802.1P/Q marking, IntServ/RSVP and DiffServ, and a strong focus on MPLS-TE and MPLS QoS.

As in most IP stacks, FIFO queuing is the default behavior. Because of lab constraints, I am unable to present labs with 802.1P/Q, DiffServ, and advanced features here.

Recently, AutoQoS was added to the Cisco portfolio, which essentially covers the following in a more proactive way:

  • QoS classification and marking

  • QoS configuration and monitoring

  • QoS congestion avoidance

  • QoS congestion management

  • QoS link-efficiency mechanisms

  • QoS policing and shaping

  • QoS signaling

  • ATM/Frame Relay QoS

  • LAN switching QoS

mrouted and DVMRP

For direct communication of two multicast participants on the same subnet, no multicast routing protocols are necessary; IGMP completely suffices. As soon as the multicast traffic traverses intermediate routers, multicast routing (signaling) becomes mandatory to forward this traffic successfully. Static multicast routing entries do not scale at all. mrouted is the dominant UNIX multicast routing daemon, currently version 3.9-beta3, and was developed by Steve Deering and Bill Fenner. This tool compiles well on all platforms; however, it requires a patch on Linux gateways and a change to the Makefile of older OpenBSD versions (as described later in this chapter).

mrouted is based on DVMRP and consists of three binaries: mrouted, map-mbone, and mrinfo (which is an ancillary tool). In contrast, DVMRP is a protocol for densely distributed multicast subscribers in high-bandwidth LAN environments and uses the flood-and-prune or implicit join method. For a detailed explanation of the protocol, consult RFC 1075.

mrouted and the MBONE

Although Cisco does not natively support DVMRP, mrouted cooperates with the Cisco IOS DVMRP interoperability implementation of PIM. That is why PIM is configured in all the following labs involving Cisco routers.

MBONE is the former multicast testbed of the Internet research community. It is based on DVMRP and has more or less been replaced by PIM-based modern architectures such as the European research network GEANT, the M6BONE, or the Internet2 "Abilene" Project.

MBONE tunneling was an approach analogous to IPv6 tunnel connections to the 6BONE (IPv6 backbone). An Internet (isolated multicast islands) not yet or only partially capable of native multicast routing delivers unicast tunnel traffic between multicast realms. The same is true for IPv6. Not all Internet routers can deal with IPv6 yet; therefore, the traffic is encapsulated into IPv4 headers and delivered that way. Essentially, these are either IP-IP or Generic Routing Encapsulation (GRE) tunnels. mrouted provides its own tunnel setup (IP-IP) and facilitates DVMRP. DVMRP is plagued by the usual scalability and convergence problems of all distance-vector routing protocols. Figure 14-2 illustrates the traditional MBONE architecture.

Although MBONE is outdated and not maintained anymore, mrouted and DVMRP still are a viable solution for smaller networks based on UNIX gateways. mrouted includes native IP-IP tunnel support (as long as it is supported by the underlying operating system).

NOTE

mtrace and mstat are additional useful tools that are available on some systems to debug multicast problems. The mrouted default configuration file is /etc/mrouted.conf. Consult the excellent manual page and command-line help for further information, especially how to send UNIX signals to the daemon to dump status information (SIGUSR1, SIGUSR2).


Cisco IOS architecture supports DVMRP only for backward compatibility for mrouted gateways and MBONE tunnel connections. If you want to hook up to the MBONE, contact your Internet service provider (ISP) or research networks in your vicinity to provide you with a DVMRP tunnel neighbor address.

Lab 14-1: DVMRP via mrouted

This lab facilitates the topology in Figure 14-3, in which we observe the DVMRP dialogue between all four multicast gateways and one redundant DVMRP tunnel between ganymed and scar (Example 14-4). The threshold in Example 14-4 is DVMRP's way of implementing TTL scoping, as described earlier in this chapter. The scar configuration, as shown in Example 14-3, has not changed.

Note that some operating systems require a default routing entry for multicast prefixes, such as route add -net 224.0.0.0 netmask 240.0.0.0 eth0, to deal with multicast groups properly when not using a multicast routing daemon such as mrouted or pimd.

NOTE

To be able to compile mrouted from sources on older OpenBSD versions, you must add-DRAW_OUTPUT_IS_RAW to the CFLAGS line in the Makefile, as follows: CFLAGS= -O ${MCAST_INCLUDE} ${SNMPDEF} ${RSRRDEF} -DRAW_OUTPUT_IS_RAW. Thanks to Bill Fenner for pointing this out.


CAUTION

When configuring mrouted tunnels on Linux, do not forget to load the tunnel kernel module (insmod ipip).


Example 14-4. mrouted Tunnel Setup on Ganymed
[root@ganymed:~#] cat /etc/mrouted.conf

#

# DVMRP IP-IP tunnel ganymed <--> scar with a multicast rate_limit of 500 kbps

tunnel 192.168.1.254 192.168.14.254 metric 1 threshold 64 rate_limit 500


If you require DVMRP tunnels from a Linux gateway, mrouted creates DVMRP interfaces automatically at runtime (Example 14-5). Examples 14-6 through 14-9 show various multicast and DVMRP-related commands, debugging of, and output for the UNIX multicast gateways. Finally, Example 14-10 shows sniffer output of the DVMRP protocol operation.

Example 14-5. Automatic Linux DVMRP Tunnel Interface Creation
[root@callisto:~#] ifconfig

...

dvmrp2 Link encap:IPIP Tunnel HWaddr

UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1480 Metric:1

RX packets:1 errors:0 dropped:0 overruns:0 frame:0

TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:0

RX bytes:76 (76.0 b) TX bytes:0 (0.0 b)

...


Example 14-6. Scar DVMRP Operation
scar# show ip mroute summary

IP Multicast Routing Table

Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,

L - Local, P - Pruned, R - RP-bit set, F - Register flag,

T - SPT-bit set, J - Join SPT, M - MSDP created entry,

X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,

U - URD, I - Received Source Specific Host Report

Outgoing interface flags: H - Hardware switched

Timers: Uptime/Expires

Interface state: Interface, Next-Hop or VCD, State/Mode



(*, 224.0.1.111), 00:19:03/00:00:00, RP 0.0.0.0, OIF count: 3, flags: DCL

(*, 224.0.1.40), 00:19:03/00:00:00, RP 0.0.0.0, OIF count: 3, flags: DCL

(*, 224.2.2.2), 00:19:03/00:00:00, RP 0.0.0.0, OIF count: 3, flags: DCL

(192.168.1.1, 224.2.2.2), 00:00:25/00:02:34, OIF count: 1, flags: CL

(192.168.2.7, 224.2.2.2), 00:01:43/00:01:16, OIF count: 2, flags: CL



scar# show ip mroute

IP Multicast Routing Table

Flags: D - Dense, S - Sparse, B - Bidir Group, s - SSM Group, C - Connected,

L - Local, P - Pruned, R - RP-bit set, F - Register flag,

T - SPT-bit set, J - Join SPT, M - MSDP created entry,

X - Proxy Join Timer Running, A - Candidate for MSDP Advertisement,

U - URD, I - Received Source Specific Host Report

Outgoing interface flags: H - Hardware switched

Timers: Uptime/Expires

Interface state: Interface, Next-Hop or VCD, State/Mode



(*, 224.0.1.111), 00:18:16/00:00:00, RP 0.0.0.0, flags: DCL

Incoming interface: Null, RPF nbr 0.0.0.0

Outgoing interface list:

Tunnel0, Forward/Dvmrp, 00:17:20/00:00:00

Ethernet0, Forward/Sparse-Dense, 00:18:16/00:00:00

Ethernet1, Forward/Sparse-Dense, 00:17:51/00:00:00



(*, 224.0.1.40), 00:18:16/00:00:00, RP 0.0.0.0, flags: DCL

Incoming interface: Null, RPF nbr 0.0.0.0

Outgoing interface list:

Tunnel0, Forward/Dvmrp, 00:17:20/00:00:00

Ethernet0, Forward/Sparse-Dense, 00:18:16/00:00:00

Ethernet1, Forward/Sparse-Dense, 00:17:51/00:00:00



(*, 224.2.2.2), 00:18:16/00:00:00, RP 0.0.0.0, flags: DCL

Incoming interface: Null, RPF nbr 0.0.0.0

Outgoing interface list:

Tunnel0, Forward/Dvmrp, 00:17:27/00:00:00

Ethernet0, Forward/Sparse-Dense, 00:18:16/00:00:00

Ethernet1, Forward/Sparse-Dense, 00:18:10/00:00:00



(192.168.1.1, 224.2.2.2), 00:02:40/00:00:19, flags: CL

Incoming interface: Tunnel0, RPF nbr 192.168.1.254, Dvmrp

Outgoing interface list:

Ethernet1, Forward/Sparse-Dense, 00:02:32/00:00:00

Ethernet0, Forward/Sparse-Dense, 00:01:23/00:00:00



(192.168.2.7, 224.2.2.2), 00:00:55/00:02:04, flags: CL

Incoming interface: Tunnel0, RPF nbr 192.168.1.254, Dvmrp

Outgoing interface list:

Ethernet1, Forward/Sparse-Dense, 00:00:28/00:00:00



scar# show ip dvmrp route

DVMRP Routing Table - 6 entries

192.168.1.0/24 [0/2] uptime 00:09:41, expires 00:02:43, poison 0x00000000

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]

192.168.2.0/24 [0/2] uptime 00:09:38, expires 00:02:43

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]

192.168.7.0/24 [0/3] uptime 00:09:41, expires 00:02:43, poison 0x00020000

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]

192.168.14.0/24 [0/3] uptime 00:09:38, expires 00:02:43, poison 0x00010000

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]

192.168.80.0/24 [0/2] uptime 00:09:21, expires 00:02:43

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]

211.11.117.0/24 [0/2] uptime 00:09:21, expires 00:02:43

via 192.168.1.254, Tunnel0, [version mrouted 3.255] [flags: GPM]



scar# mrinfo 192.168.1.254

192.168.1.254 [version mrouted 3.255] [flags: GPM]:

192.168.1.254 -> 192.168.1.1 [1/1]

192.168.2.254 -> 192.168.2.7 [1/1]

211.11.117.206 -> 0.0.0.0 [1/1/querier/leaf]

192.168.80.254 -> 192.168.80.1 [1/1]

192.168.1.254 -> 192.168.14.254 [1/64/tunnel]

211.11.117.206 -> 62.178.158.124 [1/64/tunnel/down/leaf]



scar# mstat 192.168.14.254

Type escape sequence to abort.

Mtrace from 192.168.14.254 to 192.168.14.254 via RPF

From source (?) to destination (?)

Waiting to accumulate statistics......

Results after 10 seconds:



Source Response Dest Packet Statistics For Only For Traffic

192.168.14.254 192.168.14.254 All Multicast Traffic From 192.168.14.254

| __/ rtt 0 ms Lost/Sent = Pct Rate To 0.0.0.0

v / hop 0 ms --------------------- --------------------

192.168.14.254 ?

| \__ ttl 0

v \ hop 0 ms 0 0 pps 0 0 pps

192.168.14.254 192.168.14.254

Receiver Query Source



scar# mtrace

Source address or name: 192.168.14.254

Destination address or name: 192.168.1.254

Group address or name:

Multicast request TTL [64]:

Response address for mtrace:

Type escape sequence to abort.

Mtrace from 192.168.14.254 to 192.168.1.254 via RPF

From source (?) to destination (?)

Querying full reverse path...

0 192.168.1.254

-1 192.168.1.254 DVMRP Wrong interface [192.168.14.0/24]

-2 192.168.1.1 DVMRP [192.168.14.0/24]


Example 14-7. Callisto mrouted Operation (DVMRP)
[root@callisto~#] ps ax | grep mrouted

4307 pts/0 S 0:00 mrouted

5617 pts/2 R 0:00 grep mrouted



[root@callisto:~#] kill -SIGUSR1 4307

[root@callisto:~#] kill -SIGUSR2 4307



[root@callisto:~#] cat /var/tmp/mrouted.cache

mrouted version 3.9-beta3 up 5:54:15 Tue Dec 30 00:42:43 2003



Multicast Routing Cache Table (4 entries)

Origin Mcast-group CTmr Age Ptmr Rx IVif Forwvifs

<(prunesrc:vif[idx]/tmr) prunebitmap

>Source Lifetime SavPkt Pkts Bytes RPFf

192.168.1/24 224.0.1.1 0:03:30 5:53:45 - - 1

>192.168.1.1 5:53:45 0 175 5600 0

192.168.1/24 224.2.2.2 0:03:40 1:07:51 - - 1 0

>192.168.1.1 1:07:51 0 2306 449866 0

>192.168.1.2 1:07:34 0 3816 577632 0

192.168.2/24 224.2.2.2 0:03:32 0:47:45 - - 1 0

>192.168.2.7 0:47:45 0 2344 404059 0



[root@callisto:~#] cat /var/tmp/mrouted.dump

mrouted version 3.9-beta3 up 5:54:11 Tue Dec 30 00:42:39 2003

vifs_with_neighbors = 2



Virtual Interface Table

Vif Name Local-Address M Thr Rate Flags

0 eth0 192.168.14.1 subnet: 192.168.14/24 1 1 0 querier

peers: 192.168.14.254 (12.2) [0] up 2:58:36

group host (time left): 224.2.2.2 192.168.14.254 ( 0:03:52)

224.0.0.4 192.168.14.1 ( 0:03:52)

224.0.0.2 192.168.14.1 ( 0:03:49)

IGMP querier: 192.168.14.1 (this system)

Nbr bitmaps: 0x0000000000000001

pkts/bytes in : 0/0

pkts/bytes out: 3413/619795



1 eth1 192.168.1.1 subnet: 192.168.1/24 1 1 0 querier

peers: 192.168.1.254 (3.255) [1] have-genid up 0:47:54

group host (time left): 224.2.2.2 192.168.1.1 ( 0:03:43)

239.255.255.250 192.168.1.2 ( 0:03:52)

224.0.1.1 192.168.1.1 ( 0:03:44)

224.0.0.4 192.168.1.1 ( 0:03:49)

224.0.0.2 192.168.1.1 ( 0:03:43)

IGMP querier: 192.168.1.1 (this system)

Nbr bitmaps: 0x0000000000000002

pkts/bytes in : 8820/1461369

pkts/bytes out: 0/0





Multicast Routing Table (6 entries)

Origin-Subnet From-Gateway Metric Tmr Fl In-Vif Out-Vifs

211.11.117/24 192.168.1.254 2 45 .. 1 0*

192.168.80/24 192.168.1.254 2 45 .. 1 0*

192.168.14/24 1 90 .. 0 1[1]

192.168.7/24 192.168.14.254 2 45 .. 0 1*

192.168.2/24 192.168.1.254 2 45 .. 1 0*

192.168.1/24 1 90 .. 1 0*


Example 14-8. Castor mrouted Operation (DVMRP)
[root@castor:~#] netstat –g –f inet



Virtual Interface Table

Vif Thresh Rate Local-Address Remote-Address Pkts-In Pkts-Out

0 1 0 192.168.2.7 1373 5237

1 1 0 192.168.7.7 1007 5174

2 1 0 192.168.80.1 0 0



IPv4 Multicast Forwarding Cache

Origin Group Packets In-Vif Out-Vifs:Ttls

192.168.2.7 224.2.2.2 4230 0 1:1

192.168.1.1 224.2.2.2 2347 0 1:1

[root@castor:~#] netstat -gs -f inet

IPv4 multicast forwarding:

7898 multicast forwarding cache lookups

3 multicast forwarding cache misses

3 upcalls to mrouted

0 upcall queue overflows

0 upcalls dropped due to full socket buffer

0 cache cleanups

3 datagrams with no route for origin

0 datagrams arrived with bad tunneling

0 datagrams could not be tunneled

1006 datagrams arrived on wrong interface

0 datagrams selectively dropped

0 datagrams dropped due to queue overflow

0 datagrams dropped for being too large



[root@castor:~#] map-mbone 192.168.14.254



192.168.7.254 (scar.nerdzone.org): alias for 192.168.14.254



192.168.14.254:

192.168.14.254: 192.168.1.254 [1/0/tunnel]

192.168.14.254 [1/0/querier]

192.168.7.254: 192.168.7.254 (scar.nerdzone.org) [1/0/querier]



[root@castor:~#] mtrace 192.168.14.254

mtrace: WARNING: no multicast group specified, so no statistics printed

Mtrace from 192.168.14.254 to 192.168.2.7 via group 0.0.0.0

Querying full reverse path...

0 castor.nerdzone.org (192.168.2.7)

-1 castor.nerdzone.org (192.168.2.7) DVMRP thresh^ 1

-2 scar.nerdzone.org (192.168.7.254) PIM thresh^ 0

-3 ? (192.168.14.254)

Round trip time 2 ms; total ttl of 1 required.



[root@castor:~#] mrinfo 192.168.14.254

192.168.14.254 (192.168.14.254) [version 12.2]:

192.168.7.254 -> 0.0.0.0 (local) [1/0/pim/querier]

192.168.14.254 -> 0.0.0.0 (local) [1/0/pim/querier]

192.168.14.254 -> 192.168.1.254 (192.168.1.254) [1/0/tunnel]


Example 14-9. Ganymed mrouted Operation (DVMRP)
[root@ganymed:~#] netstat -g -f inet



Virtual Interface Table

Vif Thresh Limit Local-Address Remote-Address Pkt_in Pkt_out

0 1 0 192.168.1.254 1814 2966

1 1 0 192.168.2.254 3010 1814

2 1 0 211.11.117.206 0 0

3 1 0 192.168.80.254 0 0

4 64 500 192.168.1.254 192.168.14.254 0 0

5 64 500 211.11.117.206 62.178.158.124 0 0



Multicast Forwarding Cache

Hash Origin Mcastgroup Traffic In-Vif Out-Vifs/Forw-ttl

90 192.168.2.7 224.2.2.2 2k 1 0/1 4/64

250 192.168.1.1 224.2.2.2 1k 0 1/1 4/64



Total no. of entries in cache: 2



[root@ganymed:~#] netstat –gs

multicast routing:

5 datagrams with no route for origin

5 upcalls made to mrouted

0 datagrams with malformed tunnel options

0 datagrams with no room for tunnel options

5 datagrams arrived on wrong interface

0 datagrams dropped due to upcall Q overflow

0 datagrams dropped due to upcall socket overflow

0 datagrams cleaned up by the cache

0 datagrams dropped selectively by ratelimiter

0 datagrams dropped - bucket Q overflow

0 datagrams dropped - larger than bkt size

multicast forwarding:

0 multicast forwarding cache lookups

0 multicast forwarding cache misses

0 upcalls to mrouted

0 upcall queue overflows

0 upcalls dropped due to full socket buffer

0 cache cleanups

0 datagrams with no route for origin

0 datagrams arrived with bad tunneling

0 datagrams could not be tunneled

0 datagrams arrived on wrong interface

0 datagrams selectively dropped

0 datagrams dropped due to queue overflow

0 datagrams dropped for being too large



[root@ganymed:~#] cat /var/tmp/mrouted.cache

mrouted version 3.9-beta3+IOS12 up 1:00:43 Tue Dec 30 00:55:39 2003



Multicast Routing Cache Table (2 entries)

Origin Mcast-group CTmr Age Ptmr Rx IVif Forwvifs

<(prunesrc:vif[idx]/tmr) prunebitmap

>Source Lifetime SavPkt Pkts Bytes RPFf

192.168.7/24 224.0.1.32 0:01:10 0:03:51 0:56:10 0 1P

192.168.1/24 224.2.2.2 0:01:20 1:00:42 - - 0 1 4

>192.168.1.1 1:00:42 0 1869 371617 1

192.168.2/24 224.2.2.2 0:02:30 1:00:42 - - 1 0 4

>192.168.2.7 1:00:42 0 3065 520226 1

[root@ganymed:~#] cat /var/tmp/mrouted.dump

mrouted version 3.9-beta3+IOS12 up 1:00:40 Tue Dec 30 00:55:36 2003



vifs_with_neighbors = 4



Virtual Interface Table

Vif Name Local-Address M Thr Rate Flags

0 ne3 192.168.1.254 subnet: 192.168.1/24 1 1 0

peers: 192.168.1.1 (3.255) [3] have-genid up 1:00:44

group host (time left): 239.255.255.250 192.168.1.2 ( 0:03:23)

224.0.1.1 192.168.1.1 ( 0:03:19)

224.0.0.9 192.168.1.2 ( 0:03:23)

224.2.2.2 192.168.1.2 ( 0:03:19)

224.0.0.2 192.168.1.1 ( 0:03:25)

224.0.0.4 192.168.1.1 ( 0:03:23)

IGMP querier: 192.168.1.1 up 0:59:24 last heard 0:01:05 ago

Nbr bitmaps: 0x0000000000000008

pkts/bytes in : 1865/370669

pkts/bytes out: 3018/512513



1 ne4 192.168.2.254 subnet: 192.168.2/24 1 1 0

peers: 192.168.2.7 (3.255) [1] have-genid up 1:00:46

group host (time left): 224.2.2.2 192.168.2.7 ( 0:04:04)

224.0.0.4 192.168.2.7 ( 0:04:05)

224.0.0.2 192.168.2.7 ( 0:04:02)

IGMP querier: 192.168.2.7 up 1:00:46 last heard 0:00:25 ago

Nbr bitmaps: 0x0000000000000002

pkts/bytes in : 3062/519723

pkts/bytes out: 1865/370669



2 ne5 211.11.117.206 subnet: 211.11.117/24 1 1 0 querier leaf

IGMP querier: 211.11.117.206 (this system)

Nbr bitmaps: 0x0000000000000000

pkts/bytes in : 0/0

pkts/bytes out: 0/0



3 vlan0 192.168.80.254 subnet: 192.168.80/24 1 1 0

peers: 192.168.80.1 (3.255) [2] have-genid up 1:00:46

group host (time left): 224.0.0.2 192.168.80.1 ( 0:04:02)

224.0.0.4 192.168.80.1 ( 0:04:01)

IGMP querier: 192.168.80.1 up 1:00:46 last heard 0:00:20 ago

Nbr bitmaps: 0x0000000000000004

pkts/bytes in : 0/0

pkts/bytes out: 0/0



4 ne3 192.168.1.254 tunnel: 192.168.14.254 1 64 500 rexmit_prunes old-tunnel

peers: 192.168.14.254 (12.2) [0] up 1:00:51

Nbr bitmaps: 0x0000000000000001

pkts/bytes in : 0/0

pkts/bytes out: 0/0



5 ne5 211.11.117.206 tunnel: 62.178.158.124 1 64 500 leaf rexmit_prunes

graphics/ccc.gif old-tunnel

Nbr bitmaps: 0x0000000000000000

pkts/bytes in : 0/0

pkts/bytes out: 0/0





Multicast Routing Table (6 entries)

Origin-Subnet From-Gateway Metric Tmr Fl In-Vif Out-Vifs

211.11.117/24 1 50 .. 2 0[3] 1[1] 3* 4[0]

192.168.80/24 1 50 .. 3 0[3] 2* 4[0]

192.168.14/24 192.168.1.1 2 40 .. 0 2*

192.168.7/24 192.168.2.7 2 35 .. 1 2*

192.168.2/24 1 50 .. 1 0[3] 2* 4[0]

192.168.1/24 1 50 .. 0 1[1] 2* 3* 4[0]


Example 14-10. What Is Happening on the Multicast LAN (tcpdump Sniffer Output on Castor)
...

23:21:14.363044 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:21:18.366233 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0] [ttl 1]

23:21:24.421728 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:21:28.424732 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0] [ttl 1]

23:21:28.424881 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Report [tos 0xc0] [ttl 1]

23:21:34.480417 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:21:38.483146 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0] [ttl 1]

23:21:44.153874 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:21:48.156638 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0] [ttl 1]

23:21:54.207863 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:21:58.211078 192.168.2.7 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0] [ttl 1]

23:22:04.266496 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Probe [tos 0xc0]

[ttl 1]

23:22:04.266958 192.168.2.254 > DVMRP.MCAST.NET: igmp dvmrp Report [tos 0xc0]

[ttl 1]

...

23:57:18.303887 192.168.2.254 > 192.168.2.7: igmp dvmrp Ask-neighbors2 [tos 0xc0]

23:57:18.304018 192.168.2.7 > 192.168.2.254: igmp dvmrp Neighbors2 (v 3.255): [192.168.2.7

graphics/ccc.gif -> 192.168.2.254 (1/1/querier)] [192.168.7.7 -> 0.0.0.0 (1/1/querier)] [tos 0xc0]

...


NOTE

Besides the DVMRP probes and reports in Example 14-10, you also see ASK_NEIGHBORS IGMP messages used by the mrinfo and map-mbone tools.


Native-Multicast Test Applications

As examples of real-world multicast applications, the well-known ntpd (Network Time Protocol daemon) and nte (a multicast whiteboard) were chosen. ntpd was configured to run in multicast mode (224.0.1.1), and nte was configured to utilize 224.2.2.2 and UDP port 34000. This is just for testing purposes. Choose more appropriate addresses according to the IANA assignments discussed at the beginning of this chapter for your deployments. Example 14-11 shows the setup and operation of these tools.

Example 14-11. Setup and Operation of Multicast Test Applications ntp and nte
[root@castor:~#] nte 224.2.2.2/34000 &



[root@callisto:~#] nte 224.2.2.2/34000 &



[root@castor:~#] cat /etc/ntp.conf

manycastclient 224.0.1.1

multicastclient 224.0.1.1

logfile /var/log/ntp.log

driftfile /etc/ntp.drift

authenticate no



[root@castor:~#] ntpd -A -c /etc/ntp.conf



[root@callisto:~#] cat /etc/ntp.conf

manycastserver 224.0.1.1

server ntp2.curie.fr prefer minpoll 10

server ntp.obspm.fr

logfile /var/log/ntp.log

driftfile /etc/ntp.drift

authenticate no



[root@callisto:~#] ntpd -A -c /etc/ntp.conf



[root@castor:~#] netstat -g -f inet



Virtual Interface Table

Vif Thresh Rate Local-Address Remote-Address Pkts-In Pkts-Out

0 1 0 192.168.2.7 73 5387

1 1 0 192.168.7.7 0 16

2 1 0 192.168.80.1 0 0



IPv4 Multicast Forwarding Cache

Origin Group Packets In-Vif Out-Vifs:Ttls

192.168.2.7 224.2.2.2 1997 0 1:1

192.168.1.1 224.2.2.2 73 0 1:1



[root@castor:~#] netstat -gs -f inet

IPv4 multicast forwarding:

6064 multicast forwarding cache lookups

4 multicast forwarding cache misses

4 upcalls to mrouted

0 upcall queue overflows

0 upcalls dropped due to full socket buffer

0 cache cleanups

4 datagrams with no route for origin

0 datagrams arrived with bad tunneling

0 datagrams could not be tunneled

0 datagrams arrived on wrong interface

0 datagrams selectively dropped

0 datagrams dropped due to queue overflow

0 datagrams dropped for being too large



[root@callisto:~#] netstat -g

IPv6/IPv4 Group Memberships

Interface RefCnt Group

--------------- ------ ---------------------

lo 1 ALL-SYSTEMS.MCAST.NET

eth0 1 ALL-ROUTERS.MCAST.NET

eth0 1 DVMRP.MCAST.NET

eth0 1 ALL-SYSTEMS.MCAST.NET

eth1 1 224.2.2.2

eth1 1 NTP.MCAST.NET

eth1 1 ALL-ROUTERS.MCAST.NET

eth1 1 DVMRP.MCAST.NET

eth1 1 ALL-SYSTEMS.MCAST.NET



[root@callisto:~#] tcpdump -i eth1 host 224.0.1.1

tcpdump: listening on eth1

14:14:48.005140 callisto > NTP.MCAST.NET: igmp v2 report NTP.MCAST.NET (DF) [tos 0xc0]

graphics/ccc.gif [ttl 1]



[root@castor:~#] tcpdump -i xl0 host 224.0.1.1

tcpdump: listening on xl0

14:14:01.031783 castor.nerdzone.org.ntp > NTP.MCAST.NET.ntp: v4 client strat 0 poll 6

graphics/ccc.gif prec -28 [tos 0x10] [ttl 1]

14:15:01.575187 castor.nerdzone.org > NTP.MCAST.NET: igmp v2 report NTP.MCAST.NET [ttl 1]


NOTE

When you run into problems with multicast applications, pay close attention to what interface(s) the application actually binds. The mtest package is a great tool to debug such issues.

Kesehatan

 

© Copyright Cisco elearning 2010 -2011 | Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.