I have read RTP Packet maximum size? and What is the max rtsp(over tcp) packet size? but that didn't answer on my problem.
How can I find out what is the max size of rtp/rtsp? is that depend only on MTU ? there is no way that rtp/rtsp will be bigger than MTU ?
I have change the MTU with ifconfig eth1 mtu 1000 up but still I got RTSP packet with 1440 length
How can I find out what is the max size of rtp/rtsp? is that depend
only on MTU ? there is no way that rtp/rtsp will be bigger than MTU ?
In practice a RTP of 1400 bytes is a good size in 99.9% of time.
There is no real limit as you may use IP level fragmentation and/or Ethernet Jumbo-frame.
In summary, the max size of RTP is not dependent on MTU but on the codec/framing in use.
I have change the MTU with ifconfig eth1 mtu 1000 up but still I got
RTSP packet with 1440 length
ifconfig eth1 mtu 1000 set a 1000 MTU on the eth1 interface.
It is not possible to send larger datagrams than 1000,
but eth1 is still able to receive larger datagrams.
If you think about it interface-MTU is rather different of actual path-MTU between two hosts.
If you have such a specific need, you should be looking to implement MTU path discovery.
Related
The MTU for 802.11 is 2296 bytes. Does this mean that if TCP is used over 802.11, the MSS can only be 2296 - 40 = 2256? Can't one use a higher MSS which would then get fragmented over 802.11?
In short, is there a strict limit on the MSS for TCP?
The MTU for 802.11 is 2296 bytes.
Are you sure about that number? This answer says it's 2304.
Does this mean that if TCP is used over 802.11, the MSS can only be
2296 - 40 = 2256?
Assuming that the MTU is 2296, that's correct. You lose at least 20 bytes for an IPv4 header, and 20 more bytes (at least) on a TCP header.
Can't one use a higher MSS which would then get fragmented over
802.11?
Why would you want that? TCP implementations actively try to avoid IP fragmentation using MTU discovery. If a TCP segment is fragmented, and one of the fragments is lost or corrupted, the entire segment would have to be resent since TCP has no concept of IP fragmentation and as far as it is concerned, the whole segment was lost. In general, this is much more wasteful than sending smaller segments that wouldn't be fragmented. This is especially true in wireless networks where frames tend to become corrupt quite often.
As we all perfectly know, UDP does not support retransmission along with some other things.
We also aware of such thing like MTU that works basically in the following way -- when one of the network devices on the path between source and destination points does not support packet of some size, it just drops it.
In case of TCP, it's not a problem -- it already knows MSS after handshake that is always less than MTU (am I right?), so there's no possibility to send a packet with the size greater than MTU.
However, I wonder how does it work in case of UDP? As I already said, there's no retransmission in this protocol and there's no such thing like MSS. So what happens when the packet is dropped due to exceeding MTU?
Or it just works because of the MTU nature (it actually belongs to the IP layer, not the transport layer protocols like UDP or TCP)? So the IP layer reconstruct the dropped packet in smaller units and send it again?
First of all, you must distinguish between the local MTU, which is just the MTU of the local link, and the path MTU (PMTU), which is the smallest MTU of the local link. Consider the following topology:
1500 1480 1500
A -------- B -------- C -------- D
then A's local MTU is 1500, but the PMTU is just 1480.
When router B receives a packet of size 1500 which it needs to forward, and the DF bit is set, it sends an ICMP packet back to the sender with the next hop's MTU, 1480 in this case. The sender can then reduce the packet size.
In TCP, this is done transparently by the network stack. In UDP, the application needs to deal with it. There are three ways to do that:
always send packets that are small enough; 1024 is always safe over IPv6, and 512 is usually (but not always) safe over IPv4;
use a connected UDP socket, and react to an EMSGSIZE error by reducing the packet size; or
use any kind of UDP socket, request the PMTU ancillary data, and use the data provided.
Technique (3) is the most efficient. For IPv6, it is described in Section 11.3 of RFC 3542.
I am checking the MTU size of a USB tethering connection, but I got different results with different commands...
By using "netsh interface ip show subinterfaces" I get the following results (Local Area Connection 8 is the tethering connection):
C:\Users\Chris>netsh interface ip show subinterfaces
MTU MediaSenseState Bytes In Bytes Out Interface
4294967295 1 0 1350760 Loopback Pseudo-Interface 1
1500 2 3756376356 10363121083 Wireless Network Connection
1500 5 0 0 Local Area Connection
1500 1 178477 238360 Local Area Connection 8
But by using "ping google.com -l 1472 -f" I got the following results:
C:\Users\Chris>ping google.com -l 1472 -f
Pinging google.com [216.58.220.142] with 1472 bytes of data:
Reply from 192.168.42.129: Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
Packet needs to be fragmented but DF set.
The tethering connection is the only working connection when I check. If the MTU size is 1500 the ping method should work... I am a little bit confused here. Could anyone tell me what's the difference between the 2 method?
netsh shows the MTU of the interface itself. But your ping command sends packets through your interface into the wider world of the Internet. Somewhere along the path between your interface and google.com there is a router with a smaller MTU than 1472 bytes. This is called Path MTU.
Or: What is the maximum payload size for a TCP/IPv4 packet.
Much appreciated!
Cheers.
The MTU of an IP packet is the entire packet, including all IP and higher level headers (such as TCP headers) and payload. Lower level headers (such as Ethernet frames) are not included since they're not IP's concern. However the actual MTU value is influenced by the lower levels, as there's usually a limit, and IP has to stick to it.
MTU = IP Header + Tcp Segment
MSS = Data(doesn't include TCP header)
I am trying to understand the "big picture" of MTU. Specifically, many discussions of MTU focus on a single hop (e.g. laptop to router), so the natural question is: how to determine MTU between cable modem and ISP, or more generally, for any given hop of a route.
Now, I can easily see the MTU between my laptop and its: wi-fi router using ifconfig on Mac OS X:
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
ether 58:b0:35:f0:14:75
media: autoselect (none)
status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether 58:b0:35:72:64:fa
inet6 fe80::5ab0:35ff:fe72:64fa%en1 prefixlen 64 scopeid 0x5
inet 192.168.1.100 netmask 0xffffff00 broadcast 192.168.1.255
media: autoselect
status: active
1500 is the canonical value b/c of the limitation of the wi-fi frame (which I am guessing was designed to match the Ethernet frame; please correct me if that's wrong).
So, the question is: How to determine the MTU of arbitrary hops in my route?
Answer summary:
Per the below answer, best bet is "tcpdump", "traceroute --mtu" or "tracepath"
The thing you are looking for is Path MTU Discovery. You can see that in action with tcpdump(1) during TCP three way handshake by watching the MSS option values (you will need appropriate level of dump verbosity, afair -vv does it).
Original traceroute(8) is supposed to show you path MTU changes, but I never had luck with it. Linux tracepath(8) gives you hop MTU value right away.