Is IPv4 & IPv6 Completely Independent than Each Other? My PC has The Two Versions! C/C++ Winsock about listen()
Posted on 2008-11-08
My PC has two version of IP's. Here is what my ipconfig represents:
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . : *****.com
Link-local IPv6 Address . . . . . : ****::***:****:***:****%13
IPv4 Address. . . . . . . . . . . : 192.168.0.101
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.0.1
I created a server that listens on 4432 port. My piece of code grabs the local ip address automatically & bind to the specified port 4432. After that, it waits for connections...
After executing the server, i go to netstat -an. I see the port 4443 is listening.
I do a port scan on 4443 to see if its actually listening or not. The answer is yes and no...
If i scan the port 4443 on this address 127.0.1.1 (IPv4), i get result as 4443 is blocked.
If i scan the port 4443 on this address ****::***:****:***:**** (IPv6), i get a result as 4443 is open - which is correct ....
So my server is listening on 4443 for the IPv6, but for the IPv4.....Only clients that connects to the server by using server's IPv6/4443 will be able to communicate with the server. If a client trying to connect to the server by using servers' IPv4/4443, its connection will get refused (10061)....
When i did netstat -an i discovered some ports are listening for both IP versions, some are only listening for one IP version e.g.
Proto Local Address Foreign Address State
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING
TCP [::]:135 [::]:0 LISTENING
TCP [::]:445 [::]:0 LISTENING
TCP [::]:1025 [::]:0 LISTENING
TCP [::]:4443 [::]:0 LISTENING
Ok, ports 135, 445, and 1025 will respond to client who connects to it through IPv4 or IPv6.
4443 will only respond to client who connects to it through IPv6.
1. How come IPv4 & IPv6 are not related? Both of them are the same, in the same machine! so an open port is an open port regardless of the IP version, because the port is a port. 4443 its only number, its only one port...How come its blocked on IPv4 and open on IPv6? Machine address is a machine address, no matter on what version clients connect to me, client is connecting to the same place just by using different version of addresses, but its still connecting to the same machine which has same ports, same system, etc....Can you clarify to me please
2. How can i make my port 4443 listens for both IP versions?
I tried to explain everything above to make my question clearer. I'm looking forward to hearing from you!