LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-02-2011, 01:06 PM   #1
pabloski
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
UDP, linux and packets greater than 1500 bytes


Hi, I'm developing a tftp client and server and I want to dynamically select the
udp payload size to boost transfer performance.

I have tested it with two linux machines ( one has a gigabit ethernet card, the
other a fast ethernet one ). I changed the MTU of the gigabit card to 2048 bytes
and leaved the other to 1500.

I have used setsockopt(sockfd, IPPROTO_IP, IP_MTU_DISCOVER, &optval,
sizeof(optval)) to set the MTU_DISCOVER flag to IP_PMTUDISC_DO.

From what I have read this option should set the DF bit to one and so it should
be possible to find the minimum MTU of the network ( the MTU of the host that
has the lowest MTU ). However this thing only gives me an error when I send a
packet which size is bigger than the MTU of the machine from which I'm sending
packets.

Also the other machine ( the server in this case ) doesn't receive the oversized
packets ( the server has a MTU of 1500 ). All the UDP packets are dropped, the
only way is to send packets of 1472 bytes.

Why the hosts do this? From what I have read, if I send a packet larger than
MTU, the ip layer should fragment it.
 
Old 01-03-2011, 08:23 AM   #2
Linux.tar.gz
Senior Member
 
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,534

Rep: Reputation: 100Reputation: 100
Not all cards support MTU changes. Sometimes it can, but can't reach the max MTU. Use ifconfig to see the current MTU.
Are the PC linked via a hub/switch or cable ?
 
Old 01-04-2011, 07:25 AM   #3
pabloski
LQ Newbie
 
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Linux.tar.gz View Post
Not all cards support MTU changes. Sometimes it can, but can't reach the max MTU. Use ifconfig to see the current MTU.
Are the PC linked via a hub/switch or cable ?
In my case I'm using a gigabit ethernet card and I can set the MTU between 1500 and 7200. What I'm trying to do is using the path MTU discovery method ( I have another card which MTU is configured at 1500 ).

I have tried connecting the two PCs with a cross cable and through a router ( the router supports only 1500 bytes packets ). In both cases the packets sent from the first pc are dropped without notice.

I think this is normal behaviour, because the receiver cannot process the frame because it is oversize. Someone suggested me that I must use a router that supports jumbo frames. This way my first machine sends jumbo frames to the router, which in turn process them and then fragment them to send to the other machine ( which has a maximum MTU of 1500 ). If a set the DF bit the router should send me an ICMP reply message saying that fragmentation is requires and that the MTU of the next hop is 1500. This way I can dynamically adjust the size of the packets.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
udp packets cause kernel oops in ip_push_pending_frames linux 2.6.23.5 bugsmakemylifehell Linux - Networking 1 03-02-2010 04:46 AM
Unable to ping with packets of size 1500 bytes aditya_halan Linux - Networking 1 08-03-2007 03:21 AM
UDP: Short Packets: and UDP bad checksum: entries in dmesg minutes2memories Linux - Networking 2 02-26-2006 07:28 PM
encapsulating TCP packets in UDP packets... yoshi95 Programming 3 06-03-2004 02:53 PM
How to receive UDP and ICMP packets, by one UDP socket(PMTUD) myself_rajat Linux - Networking 0 05-28-2004 05:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration