I want to send a messaged from Windows/Linux to a IPV6 virtual IP address which I had created on Ubuntu. Can anyone suggest the process to do so?
I created Virtual IPV6 in Ubuntu by the following Code: sudo ip -6 addr add 2002:1:1:1::10/64 dev eth0
And, for sending a message to IPV6 I used this Pyhton Code:
For Client:
# Echo client program
import socket
import sys
HOST = '2002:1:1:1::10' # The remote host
PORT = 50007 # The same port as used by the server
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
try:
s = socket.socket(af, socktype, proto)
except OSError as msg:
s = None
continue
try:
s.connect(sa)
except OSError as msg:
s.close()
s = None
continue
break
if s is None:
print('could not open socket')
sys.exit(1)
s.sendall(b'Hello, world')
data = s.recv(1024)
s.close()
print('Received', repr(data))
For Server:
# Echo server program
import socket
import sys
HOST = '2002:1:1:1::10' # Symbolic name meaning all available interfaces
PORT = 50007 # Arbitrary non-privileged port
s = None
for res in socket.getaddrinfo(HOST, PORT, socket.AF_UNSPEC,socket.SOCK_STREAM, 0, socket.AI_PASSIVE):
af, socktype, proto, canonname, sa = res
# The AF_* and SOCK_* constants are now AddressFamily and SocketKind IntEnum collections.
try:
s = socket.socket(af, socktype, proto)
except OSError as msg:
s = None
continue
try:
s.bind(sa)
s.listen(1)
except OSError as msg:
s.close()
s = None
continue
break
if s is None:
print('could not open socket')
sys.exit(1)
conn, addr = s.accept()
print('Connected by', addr)
while True:
data = conn.recv(1024)
print(data)
if not data: break
conn.send(data)
conn.close()
When I run this program I receive this error: [Errno 101] Network is unreachable. And, I cant ping the virtual IPV6.