- What do these 2 code points mean in internet protocols? Do they
indicate that the immediate payload is IPv4 (#4) or IPv6 (#41)
headers? Or do they have to be interpretated rigidly according to
the 2 old RFCs.
The protocol number is in the Protocol field of the IPv4 packet header, and in the Next Header field of the IPv6 packet header. The protocol number tells IP (either IPv4 or IPv6) to which process it should pass the payload of the packet. If a process has not registered with the appropriate IP process, the packet is dropped, and normally an ICMP error message is sent back to the source.
- Is there benefit treating IPv4 and IPv6 as seperate protocols
instead of different versions of the same protocol? Can any such
benefit be also applicable to EtherType in Ethernet? (I'm asking
this because IPv4 and IPv6 can already be identified by their
leading 4 bits)
IPv4 and IPv6 are completely separate, incompatible protocols. The IPv4 process has no idea what to do with an IPv6 packet, and vice versa. Each protocol is handled by a different process, and many hosts will have one but not the other.
The Ether Type, for protocols that use such, has a similar function to the protocol number. It tells the Data-Link protocol to which process it should send the frame payload. If the Ether Type is a number not registered with the Data-Link protocol, then the frame is simply dropped. For example, a host receiving a Data-Link frame with the Ether Type
0x86DD that is not running IPv6 would simply drop the frame.
You have different tunneling protocols for different things. Your examples include tunneling IPv4 inside IPv4, IPv6 inside IPv6, and IPv6 inside IPv4. Each protocol is different because each needs to know what payload to expect so that it knows what to do with the payload. There is also GRE that has a field in its header that is the same as the IPv4 Protocol (or IPv6 Next Header) field, and that tells the GRE process to which process it should send the payload. There are many different tunnel protocols, each created by someone to fill a perceived need. Choose the one that is supported by your OS (on both ends) that does what you need it to do. Cisco created GRE to be a generic (hence the "G" in GRE) tunneling protocol.