The concept of 6to4 tunneling is to do encapsulate and descapsulate an ipv6 packet through ipv4 network. The encapsulation process is:
[IPv6 header][Transport Header][Application Protocol data]
=> encapsulation:
[Ip4 Header][IPv6 header][Transport Header][Application Protocol data]
I am talking from this infrastructure:
Host A (IPv6) -> Router R1 (dual stack) -> Ipv4 net work -> Router R2 (dual stack) -> Host B (Ipv6) packet.
The Ipv4 header in the encapsulation, which Ipv4 header is this among: Host A, Router R1, Router R2 and Host B?
Thanks in advance.
6to4 is ordinary IP over IP tunnelling. Whoever does the tunneling originates the packets. Since your Host A does not have IPv4 connectivity, it cannot act as tunnel endpoint.
As an example, I have a router (R1) Linux box with a 6to4 route that looks thus:
2000::/3 via ::192.88.99.1 dev sit0 metric 1024 mtu 1480 advmss 1420 hoplimit 0
and a IPv4 route thus:
default via XXX.YYY.210.1 dev br0
Internet IPv6 traffic coming in from LAN (e.g. from Host A) routes to sit0. The boxen on the LAN believes that they are directly connected to IPv6 internet. Traffic from sit0 is wrapped in IPv4 packets with R1 as source address and injected into br0 which connects to IPv4 internet.
The two routers R1 and R2 will do the tunneling. Packets originating from R1 will have an IPv4 header with R1's IPv4 address as the source and R2's IPv4 address as the destination (R1 sends to R2). Return IPv4 packets will have the source and destination addresses reversed (R2 sends to R1). The IPv6 addresses of the hosts A and B will pass untranslated in the header of the encapsulated packet. Normally a minimal 20 byte IP4v header is used, so the IPv6 MTU (Maximum Transmission Unit) on the tunnel will be at most 1480 bytes.
Encapsulation just consists of adding an IPv4 header to the IPv6 packet and routing it using normal IPv6 routing. The un-encapsulation just removes the IPv4 header, and routes the remaining IPv6 packet normally. It is possible for an IPv6 packet to be passed through more than one tunnel between the two hosts. The IPv4 addresses in the IPv4 will always be the address of the tunneling router (source) and the address of the tunnel end-point router (destination).
EDIT: The following was written to describe the case of described in the following paragraph. The other paragraphs supply additional background.
HostA (IPv6) and HostB (IPv4) will be unable to communicate as they don't have compatible stacks. If HostB was had an IPv6 stack they could communicate.
A dual stack host could do its own tunneling, in which case its IPv4 address would be used as its IPv4 end-point address. If NAT is being used then the address of its router would be the IPv4 end-point address while the packet was on the IPv4 network between the routers.
IPv6 does not have NAT so the IPv6 addresses will never be translated.
For an IPv6 only host to communicate with an IPv4 host, protocol translation is required. Host A could address Host B using one of the IPv6 schemes for encoding IPv4 addresses in IPv6. Router R1 would need to perform the protocol translation. (Although I don't believe there are any such routers on the market.) Again, the IPv4 end-point address on the IPv4 network would R1's IPv4 address. Some network options may not get translated during protocol translation.