qt dual-stack ipv4 & ipv6 application - qt

I have a ipv4 client/server network application written in Qt (v4), which i have to port it in ipv6 (actually the client porting is the most important one), creating in this way a dual-stack ipv4 & ipv6 application.
i do not have any ipv6 network available so as to perform any tests.
i tried the following but with no success:
find a tool that make ipv6 validation: there are not many, usually poorly documented and usually for C language
create a local ipv6 network environment
any ideas?

Definitely create a local IPv6 network environment. A lot of things work the same in IPv6 as in IPv4, but a lot of other things are different. When developing applications that use IPv6 you should have some hands-on experience. You wouldn't expect someone who has never used IP to develop an application that uses IPv4, would you?
Some key differences:
IPv6 addresses are written in hexadecimal
IPv6 hosts will probably have multiple addresses
An IPv6 address that starts with fe80:This is the link-local address. Every IPv6 hosts has one for every interface it has. Link-local addresses exist on every link (ethernet segment, LAN) and they use the same address range on each LAN. It is therefore impossible to route them, but they are very useful when communicating only within the LAN.
One or more IPv6 addresses that start with something in the range 2000: - 3fff:These addresses are the globally routable addresses that you use for normal internet communication.
Zero or more IPv6 addresses that start with something in the range fc00: - fdff:These are Unique Local Addresses (ULA). They are routed within the house, building, organisation etc. They are not routed to the global internet so you cannot reach public services with them.
And of course maybe one or more IPv4 addresses
NAT is (almost) never used with IPv6. ULA addresses are not NATed to a public address.
The best way to get experience is to use an IPv6 connection that is connected to the real IPv6 internet. If your ISP cannot provide you with IPv6 (they should these days, but many ISPs are still slacking) you can use a tunnel broker service like SixXS or Hurricane Electric. They will give you an IPv6-over-IPv4 tunnel with a /48 of addresses. That is enough for 65536 subnets of 2^64 hosts. More than enough for a development network :-) SixXS has the benefit that they provide client software that can run behind a NAT router. Hurricane Electric has the benefit that the registration procedures are much easier.

Related

About my ISP give me a static IPV6 how can i use it and what it mean

Hello guys I got a problem with IPV6 that my ISP give me. I don't really familiar with the IPV6 and this is the info that he gave me.
2001:0E68:5845:7500::/56
2001:0E68:5810:0B23::/64
what are those mean? can I use it to host a web server? can I use it on my DNS like Cloudflare?
/64 1 IPv6 subnet
what does that mean by 1 ipv6 subnet? what is the full address of that ipv6?
and this
/56 256 LAN segments
is it only used by LAN, not on WAN? what I mean is it's like we set up a webserver some IPV4 of our WAN will use at DNS for pointing that domain to ipv4. am so confusing right now please help me explain it to me.
You will typically only use standard /64 networks with IPv6, else you will break some IPv6 features (/127 for point-to-point networks and /128 for loopback addresses are the exceptions).
Your ISP is assigning the /64 network as a transit network to reach your site. The /56 prefix is a delegation, and your router should be able to automatically delegate /64 networks for the individual networks in your site.
The 2001:0E68:5810:0B23::/64 is the full network address for the transit network between the ISP and your site, and you do not normally advertise or use this network in DNS.
The 2001:0E68:5845:7500::/56 is the delegated prefix from which your router can delegate individual standard /64 networks for use within your site. You can use one of the /64 networks to derive your /127 point-to-point and /128 router loopback addresses.
Search for IPv6 Prefix Delegation.
Because these are Global IPv6 addresses, you can assign them to DNS AAAA records. You need to make sure your ISP allows any services you want to provide (very likely with such an address allocation) and be sure to allow any public services (including requests) through your firewall.

Why two hosts can't contact with each other directly use their IP address?

In a global internet, for two machines on the same subnet to communicate, they need to know each other's physical address. So, the source machine has to map the internet address of the destination into a physical address. Why is this address mapping important? Couldn't the two machines just communicate using their internet addresses?
Because the goal of the Internet is to connect different types of subnets together. It is local decision of each subnet how to organize addressing on this subnet and how to deliver packets on it. Thus layer 3 (that uses IP addresses) delivers packets up to the subnet, and then the subnet (layer 2) decides how to deliver packets within itself.
Mapping, that you are describing is done for Ethernet-type subnets. One can potentially have different types of subnet protocols which do addresses differently. Although, now, almost everyting falls under Ethernet-family.

from a web server detecting if 2 machines are on the same gateway ipv6

From a webserver, what ways, if any, can be used to detect if 2 client machines are behind the same gateway as each other?
For example if both machines are behind NAT they'll have the same IP address from the POV of the server. As of IPv6 though NAT seems less common.
Can I mostly assume if the top 64 bits of an IPv6 address are the same they're behind the same gateway?
NOTE I'm not looking for a perfect solution which is why I asked "mostly". I'm looking for a 99% solution. Ideally for home users, not corp. 99.999% of home users are on a router that's using NAT so that works for IPv4. Is there a solution for IPv6 that will also mostly be true?

Why the IP address on 2 machines on the same router having different subnet?

I have 2 machine. One's IP is 169.254.41.172 and the other is 169.254.72.175. They are both connected to the same router. Why is the 'subnet?' different? I'm referring to the 3rd number between 41 and 72.
These are linklocal addresses, they use 255.255.0.0 as subnet mask, so both addresses are in the same subnet.
These addresses are generated automatically, if you want more control over them you will either need a DHCP server, or configure static IP addresses.
Your router is not acting as a DHCP server it seems.
169.254 is a special range usually for Windows machines when they can't obtain an IP address automatically.
From: http://packetlife.net/blog/2008/sep/24/169-254-0-0-addresses-explained/
Occasionally you may encounter a host which has somehow assigned
itself an IP address in the 169.254.0.0/16 range. This is a
particularly common symptom of Windows machines which have been
configured for DHCP but for whatever reason are unable to contact a
DHCP server. When a host fails to dynamically acquire an address, it
can optionally assign itself a link-local IPv4 address in accordance
with RFC 3927. Microsoft's term for this is Automatic Private Internet
Protocol Addressing (APIPA).
These machines are not getting an IP address. The beginning octets of "169.254" identify these addresses as "link-local".
http://en.wikipedia.org/wiki/Link-local_address
For what it's worth, the addresses are not on different subnets as the full link-local definition is 169.254.0.0/16, or a "Class B" subnet. That being said though, there's no way you'll be getting these computers to communicate any time soon. Is the router powered on, are the cables connected and are there uplink lights on the actual RJ45 jacks on both the router and computers? Is DHCP enabled on the router?

what's needed to make hostname resolution work on a lan?

I am developing a networked application that runs on a few different computers on a LAN. One of the core needs is for the app to maintain a list of peers on the LAN with which it has communicated in the past, so that it can restore previous sessions. The naive solution would be to just remember the IP and store it in a table, but what happens when the IP of a peer changes?
Instead, I thought I'd store the hostname of the peers so even if the IP changes they will still be reachable via their hostname. (I know hostnames can change as well but that is good enough).
So my question is what exactly is needed to make hostname resolution work on a LAN with mixed Windows/Mac/Linux clients?
Without the use of a central authority the only reliable way to achieve this is through the use of zerconfiguration name resolution. This means that without a multicast router you will only be able to dynamically resolve peers on the same subnet as the resolving host. You could use something like bonjour for mac, netbios or ssdp for windows or avahi for linux but you can't assume that these are enabled. I may be overlooking some more popular protocols that perform this function well but I would personally throw together a quick udp broadcast name resolution protocol for your application. Take a look at these for some more ideas:
Zeroconf Name resolution
Universal local network name resolution method without DNS?
http://en.wikipedia.org/wiki/Zero_configuration_networking#Name_resolution
http://en.wikipedia.org/wiki/Broadcast_address#IP_networking
I would pick a specific udp port to listen on (lets say 12000) and then when you're ready to resolve hosts send a "hello" udp packet out to 255.255.255.255 on port 12000 and all of the other hosts on your network running your app should reply with a packet containing their hostname, possibly other information.

Resources