0

I want do develop an IP based protocol oriented to smallest possible data overhead. For example UDP adds overhead of 8 bytes header. I want zero header.

I will use this protocol via 2G mobile network where every byte is paid. For example 8 bytes every second makes 252.288MB per year. With 0.1 Euro per MB that's ~25 euro per year. I don't want to pay for UDP header :)

According to list of IP protocol numbers, which one should I use so that I don't have problems with NAT or firewalls?

5
  • You should use one of the "unassigned" ones, but as per the comment it's possible that nothing other than TCP or UDP will be allowed to work.
    – pjc50
    Commented Apr 21, 2023 at 15:17
  • This sounds like a case of premature optimization. You are making a lot of assumptions about how mobile carriers measure data usage. Even if the European Union has defined requirements, not all countries or jurisdictions have. The carriers could be counting bits differently in each country -- or worse yet -- each carrier counts bits differently in every country. Commented Apr 21, 2023 at 15:46
  • I'm not making assumptions, I know how my mobile carrier measures. He counts every byte pushed through PPPoS. Commented Apr 21, 2023 at 16:22
  • How much do you gain by compressing your data stream? Web sockets may be an option then. Commented Apr 21, 2023 at 17:24
  • Problem is that I want to transmit every second to have a real time data. It will be a few bytes, so compression doesn't help much. Commented Apr 21, 2023 at 21:52

2 Answers 2

5

To work on a network with a NAT you must use a protocol the NAT supports. Usually that means TCP or UDP. Period. And you cannot just copy the protocol number. You have to actually use the protocol.

However, if you know which network the protocol must work on, you can see if its NAT supports other protocols. If you are buying a lot of SIM cards, you can ask the network provider to install a server inside their network, for a fee, and bypass the NAT. If you are buying a lot of SIM cards and your network usage is predictable, you can also ask them for a customized billing plan tailored to your needs.

4
  • 1
    this is an important rule in business: if you are spending a million dollars, the manufacturer can afford to have a meeting with you and then manufacture precisely what you need, and that is better for both you and them. Conversely, if you are only spending $10 then the meeting literally isn't worth the time for you or for them. Commented Apr 21, 2023 at 15:06
  • I've accepted your answer, because of the NAT. But ICMP is also supported by NAT. So there may be more of them. Commented Apr 21, 2023 at 15:53
  • @user1576055 the point stands: it has to be something the NAT supports. And the NAT decodes ICMP packets by looking at the embedded UDP or TCP packet, anyway. (When a packet causes a problem and an ICMP packet is sent out, that ICMP packet includes the headers of the packet that caused the problem) Commented Apr 21, 2023 at 17:57
  • Well for ICMP ping there is no UDP or TCP packet. I will quote from another thread "For ICMP query/reply type messages like Echoes (pings), NAPT uses the ICMP Query ID (sometimes just called the ICMP ID) the same way it would use a TCP or UDP port number." Commented Apr 21, 2023 at 21:50
2

The first thing you should do is take a step back and learn more about network topology so you can understand what those protocols do and what type of information is being stored in that header b/c without it? Your data is going nowhere, especially with UDP, much less any custom protocol you attempt to design.

When your device sends a packet of data, that packet is going to be handled by any number of devices between you and the final destination and none of those devices really knows anything about you, your intentions, the data, etc.. So there needs to be some way to tell each device in that chain how to handle your packet and where it should be going next. And what do you know: turns out, that's kinda what the UDP header is there for! Pretty important 8 bytes I think. So while you may feel like those 8 bytes are wasted space, the reality is, they're essential to getting your data where it needs to go.

Lastly, any new protocol you design, has to be something that every device between you and your destination, can understand. And now you're talking about adoption and implementation. It's not an easy job to design new protocols.

9
  • 1
    Actually, knowing where the packet is going next is what the IP header is for. The UDP header is for the final destination. Commented Apr 21, 2023 at 15:22
  • Your answer doesn't help much. I know exactly what those 8 bytes do and I don't need them. Problem is NAT as user253751 mentioned. Commented Apr 21, 2023 at 15:58
  • You might not think you do, but devices handling your packets do, even if it's only at 'the last mile'. The IP protocol encapsulates data which may encapsulate data. A receiving device is going to use that IP proto number to determine how it should unwrap any data inside. So if you chose, for example, #84 (TTP), then the receiving device is going to try to handle the content according to the TTP specification which isn't going to help you much. To override that behavior, you'd need to re-write the driver for your network device to change how it handled just that specific protocol. Commented Apr 21, 2023 at 17:15
  • @incongruentDoughnut the UDP header is meant to be handled by the sending device and the receiving device. If you control both, then you can put whatever you like in that space because nobody gives a shit except you. However, NAT (which is terrible) also handles it. Commented Apr 21, 2023 at 18:02
  • @user253751 Yes, you can put whatever you want in there when you send it, but when it's unwrapped per the identifying protocol (17:UDP), it's still going to be pushed to the port indicated that header before your app can do anything to it. That delivery (to the port) happens at the transport layer (L4) and the only way you're going to change that is to re-write the drivers for your device to specifically handle UDP (or whatever proto you want to fake) differently. Commented Apr 21, 2023 at 18:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.