i am learning networks and tunneling and i have problems with understanding some things about GRE. The structure of tunneling below: [Transport Protocol][ensapsulationg protocol(GRE)][encapsulateed protocol]. Let transport and encapsulated protocol be IPv4, so the questions are: Why not just put ipv4 into ipv4? Will it make problems and how?
The network layer passes its payload to the registered upper protocol, depending on the header's protocol field: the payload requires some kind of handler for processing. At minimum, the protocol inside the encapsulation needs to be identified, just like LLC or the EtherType field do. If you didn't identify the protocol it would need to be configured on each side. Or imagine different protocols being passed through the same tunnel, e.g. IPv4 and IPv6.
Note that basic GRE does little more than multiplex the tunnel like that. Its 32 bits header (at minimum) uses 16 bit for the encapsulated protocol identification, reusing the EtherType numbers. GRE's use is so widespread because it's generic, ie. it can transport any inner protocol and its overhead is usually negligible.
Other options include IP-in-IP, but that's limited to tunneling IPv4 only.