Dynamically get IPV4 or IPV6 - woocommerce

I get the ipv4 address from a website request on 'www.examplewoocommercestore.com' (I always get some kind of IPv4 address)
Then I get a request from 'examplewoocommercestore.com' backend whenever an order is made that sometimes consist of IPV4, or IPV6 address
How can I make sure the I collect ipv6 when available, and ipv4 when available, or vice versa?
I.e. What are they doing to sometimes get ipv6 and sometimes ipv4.

Related

TCP over IPv6 to overcome NAT issues

When using TCP/IP Sockets (IPv4) for sending data from one to another device I can only access devices over their private IP address within my own WiFi. I can not send TCPs to public IP addresses because the NAT (Network Address Translation) rejects them or struggles translating into private IPs.
But with IPv6 every device gets it's own public IP. I suppose there are no private IPs then, are there? So there should not be problems with the NAT such as symmetric NAT because there will be no need of NAT.
Assuming both devices support IPv6 and know their IPv6 addresses: can I send data directly from one to the other device?
But with IPv6 every device gets it's own public IP. I suppose there are no private IPs then, are there?
Not all IPv6 addresses are public. There are loopback addresses, link-local addresses, local addresses ... - see IPv6 - Special Addresses. Devices usually have multiple IPv6 addresses (i.e. loopback, link-local, ...), but there is no guarantee that they have a global IPv6 address. This depends a lot on the network setup.
can I send data directly from one to the other device?
If both devices have a public IP, you can send data from one to the other. Only, it might not be received by the other device since firewalls deny such traffic. It is actually pretty common that a SoHo router, at least by default, doesn't allow initiating IPv6 connections from outside. Corporate firewalls also usually deny this. There might be firewalls on the device itself, too. And so on.

What is Difference between IP address and Port Number in Networking?

What is Difference between IP address and Port Number in Networking?
IP address is address of the system in the Network.
Port is address of the service within the System.
So IP address + Port defines address of the particular service on the particular system.
Think about how many application layer protocols exist (HTTP, FTP,DNS, SSH, etc). Now think about how many task/process/programs exist within your device trying to communicate over the internet. Would it be possible just one address, the IP address, to be able to handle all these different assignments and types of protocols alone? The answer is no.
The IP address is a numerical label assigned to each device connected to a computer network that uses the Internet Protocol for communication. The port number is used so the data is directed to the correct location within this device.
The IP and the port number form the structure IP:port number, 192.168.1.1:8080 for example, and the port number can hold 65536 numbers, with the following division:
0 to 1023 - Well known port numbers. Only special companies like Apple QuickTime, MSN, SQL Services, Gopher Services and other prominent services have these port numbers.
1024 to 49151 - Registered ports; meaning they can be registered to specific protocols by software corporations.
49152 to 65536 - Dynamic or private ports; meaning that they can be used by just about anybody.
IP address is use to identify a host or a group of hosts in a network
while port number is used to identify a particular service running in a host
Port number is used to identify an application/services which you want to talk to on your system. Some predefined ports like 80 = HTTP server, 23 = Telnet.
You identify a host uniquely (globally) by its IP address. So if I ever wanted to access your laptop via telnet then I'd use the IP address given to you by your ISP and the port 23
A MAC address is a layer-2 address. It is used by some layer-2 protocols, e.g. ethernet and Wi-Fi. There are 48-bit and 64-bit MAC addresses. Some layer-2 protocols use different addressing.
An IP address is the address of the layer-3 IP protocol. Different layer-3 protocols use different addressing, e.g. IPv4, IPX, and IPv6 each have different addressing.
A port number is a layer-4 address used by some layer-4 protocols, e.g. TCP and UDP. Some layer-4 protocols use different addressing, or none at all.
TCP example: RFC 793, TRANSMISSION CONTROL PROTOCOL
Multiplexing:
To allow for many processes within a single Host to use TCP
communication facilities simultaneously, the TCP provides a set of
addresses or ports within each host. Concatenated with the network
and host addresses from the internet communication layer, this forms a
socket. A pair of sockets uniquely identifies each connection. That
is, a socket may be simultaneously used in multiple connections.
You may want to learn more about the network layers.
Simply:
A socket is like a telephone (i.e. end to end device for communication)
IP is like your telephone number (i.e. address of your socket)
Port is like the person you want to talk to (i.e. the service you want to order from that address)
In networking, generally a socket is (IP+Port)
IP address: Ip address is a address of your system, it assign when your system connects to internet.There are two types of ip address available here among first one is dynamic which invokes at your system in online. Second one is static, which assign when your system get in offline.
port address Port address is an Id of server such as your using apache server that get port number default 8080 is id of apache server,If you can change server port number.
IP address is your system domain name or socket address of specific system like 192.168.0.1
but the port number is the number of specific location or folder where to you want to write your file or any file transfer like: 3308
The IP address of your computer (host) is the mix of the network ID of the ISP/any other provider (uniquely provided by the ICANN group) and the host name (provided by the Network administrator). The Network ID is unique for all the network and among two networks, we can have same host names but on the same network, the host names can not be the same. So, this is how the host can be identified on the network and data can be transferred. But on the same host multiple applications will be running and once the data reach to the host, we need an identifier to recognize which application data is this TCP Segment/UDP datagram.
The Port number is 16 bits (possibly 65K application can run) and assigned by the Network operating system when the application process creates the sockets. On the Server side, the port numbers are well defined numbers (HTTP- Port #80, SMTP- Port#25). The port number is transport layer addressing (L4) and goes in the header of TCP/UDP.

What are the functions of the first and last IP address of every subnet?

I am new to IPs and subnets. I can calculate it and know the basics. Unfortunately, I couldn't find an answer to this question.
IPs ending on 0 designate the network address. Commonly, this address defines the route which traffic will be sent to.
Imagine that you have two routers connected by serial, so you have two subnets with 2 different private IPs: 10.0.0.0/8 and 11.0.0.0/8. /8 defines the address length in bits (Class A IP). First router will route traffic to 10.0.0.0 and second router will route traffic to 11.0.0.0.
IPs ending on 255 designate the broadcast address, a special address used to deliver packets to all hosts in the network.
For example, in case of ARP is very useful to locate/query other device's MAC by sending to the broadcast address a packet where you ask who has the MAC of a specefied IP. All the devices will capture your ARP request and if any of them has the specified IP, then you'll get a response with the MAC, but notice that you can be tricked since MAC can be impersonated (ARP Spoofing).
Regards.

Do TCP Ports belong to the Host or the IP Address?

I understand TCP/IP addresses, and I understand ports, but I don't know whether the ports are tied to the Host (and hence one host gets one port 80), or whether the ports are tied to the IP Address (and hence one host with 2 NICs/IP-Addresses gets 2 port 80s)?
A port belongs to an IP address. If a host has two NICs , and a program binds to only one IP address, the same port can still be used by another program(given that it binds to another IP address).
The answer is 'both'.
If you bind to a specific IP:port, you can have as many bindings using the same port number as you have IP addresses.
If you bind to 0.0.0.0:port, or ::port in IPv6, the port is global to all possible IP addresses of the host, including those that don't exist yet.
But I agree with #DavidShwartz, the question is a bit ill-formed. The fact is that the endpoint is defined by IP:port, not just by port. A port isn't a real thing that you can actually count. It's just a 16-bit number.

qt dual-stack ipv4 & ipv6 application

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.

Resources