Nov 5, 2008

MTU manipulation

以下這篇文章是轉載PacketLife的一篇文章,因為我發現有很多人事實上在準備CCNA/CCNP的過程中有時只著重在筆試的重點上,但是卻忽略了更重要的基礎理論,像這一篇就是介紹MSS(Maximum Segement Size)與MTU(Maximum Transmission Unit)差別,雖然沒有談很多,但是一圖勝過千言萬語,只要把底下那張圖片記在腦海裏,就不會搞不清楚MSS跟MTU的差別了。

Posted by stretch in Networking on Wednesday, 5 Nov 2008 at 2:26 a.m. GMT

The Maximum Transmission Unit (MTU) is the maximum length of data that can be transmitted by a protocol in one instance. For example, the MTU of Ethernet (by default 1500) is the largest number of bytes that can be carried by an Ethernet frame (excluding the header and trailer). MTUs are found at various layers of the OSI model, and can often be tweaked to more efficiently transport large volumes of data.

MTU comparison

Ethernet

The default Ethernet MTU is 1500 bytes, not including the header or trailer. Sometimes a slightly higher MTU is preferable to accommodate Q-in-Q tunneling or other encapsulation. The MTU can be raised on Cisco IOS with the system mtucommand under global configuration:

Switch(config)# system mtu ?   <1500-1998>  MTU size in bytes   
jumbo Set Jumbo MTU value for GigabitEthernet or TenGigabitEthernet interfaces 

The maximum MTU is dependent on the hardware platform, but the IEEE 802.3 standards require a minimum MTU of 1500 bytes. Additionally, a jumbo MTU for 1 Gbps and 10 Gbps interfaces can be allowed up to 9000 bytes. Changing either of these values will require a device power cycle.

Switch(config)# system mtu 1508 
Changes to the system MTU will not take effect until the next reload is done 
Switch(config)# system mtu jumbo 9000 
Changes to the system jumbo MTU will not take effect until the next reload is done 
Switch# show system mtu  
System MTU size is 1500 bytes On next reload, System MTU will be 1508 bytes  
System Jumbo MTU size is 1500 bytes On next reload, System Jumbo MTU will be 9000 bytes 

IP

As with Ethernet frames, the MTU can be adjusted for IP packets. However, the IP MTU is configured per interface rather than system-wide, with the ip mtu command:

Router(config)# interface f0/0 
Router(config-if)# ip mtu ?   <68-1500>  MTU (bytes) 

Notice that the maximum IP MTU is capped at the Ethernet MTU, because it is being applied to an Ethernet interface. The configured IP MTU determines how large a packet to be transmitted out the interface may be. IP packets larger than the MTU are discarded, and may prompt the router to send a Fragmentation Needed ICMP packet back to the source to facilitate path MTU discovery.

It's also worth noting that while the Ethernet and IP MTUs effectively refer to the same section of an IP/Ethernet packet, they can be configured independently. For example, assume we want to shrink the IP MTU of an interface to 1200 bytes:

Router(config)# interface f0/0 
Router(config-if)# ip mtu 1200 

The IP MTU has been modified from its default of 1500:

Router# show ip interface f0/0 
FastEthernet0/0 is up, line protocol is up   
Internet address is 10.0.0.1/24   Broadcast address is 255.255.255.255   Address determined by setup command   MTU is 1200 bytes ... 

However, the interface's Ethernet MTU remains unchanged:

Router# show interface f0/0 FastEthernet0/0 is up, line protocol is up    Hardware is Gt96k FE, address is c200.5867.0000 (bia c200.5867.0000)   
Internet address is 10.0.0.1/24   MTU 1500 bytes, BW 10000 Kbit, DLY 1000 usec,       reliability 255/255, txload 1/255, rxload 1/255 

TCP

There are two contexts in which the TCP Maximum Segment Size (MSS) can be configured: transient traffic and terminating traffic.

Transient Traffic

When a TCP client initiates a connection to a server, it includes its MSS as an option in the first (SYN) packet. On an Ethernet interface, this value is typically 1460 (1500 byte Ethernet MTU - 20 byte IP header - 20 byte TCP header).

TCP MSS option

However links beyond the host often have a lower effective MSS and full-size packets from the client may be dropped. To inspect and alter the MSS option included in TCP SYN packets passing through the router, use the ip tcp adjust-msscommand on the interface:

Router(config)# interface f0/0 
Router(config-if)# ip tcp adjust-mss ?   <500-1460>  Maximum segment size in bytes 

Terminating Traffic

Terminating traffic refers to TCP packets which originate from or are destined for the local router (for example, SSH or BGP). In this context, the router itself is considered the TCP client and/or server. The local MSS can be configured with theip tcp mss command under global configuration:

Router(config)# ip tcp mss ?   <68-10000>  MSS 

Post a Comment