Re: no route to host with ipv6?
Re: no route to host with ipv6?
- Subject: Re: no route to host with ipv6?
- From: Joshua Graessley <email@hidden>
- Date: Tue, 17 Jun 2003 10:50:06 -0700
The address you're getting is an IPv6 Link-Local address. IPv6
addresses should not be placed in DNS for two reasons.
1) They are specific to the local link
2) They require a scope_id which can not be communicated through a DNS
query.
IPv6 handles multihoming a little better than IPv4. IPv6 addresses use
something called a "scope id". The scope id for link-local addresses
identifies which interface the link-local address is on. This is
necessary because IPv6 Link Local addresses may be found on more than
one interface even though those interfaces are on separate links. A
common example is a laptop with built-in and wireless. Both are
connected to two different networks that are not bridged. If the laptop
needs to communicate with fe80::1:2:3, the laptop has no way to know if
it should look for fe80::1:2:3 on en0 (ethernet) or en1 (airport). In
addition, there may be an fe80::1:2:3 on both ethernet and airport, so
the address alone is ambiguous. The result is a no route to host error.
The scope_id is specific to the local machine. Each interface has an
index number. The scope_id specifies an interface by index. The IPv6LL
address in addition to the scope_id provides a unique identifier
without the ambiguity of an IPv6LL address alone.
In a future release, the mDNSResponder will return IPv6 addresses in
addition to IPv4. The resolver library will remember which interface
the mDNS packet was received on and use that as the scope id, enabling
clients to resolve names to IPv6 link-local addresses.
Kame uses a trick where it embeds the scope_id in the third and fourth
bytes of the IPv6 address. You may see this in a few places.
scope ids are tricky and confusing, but they make a lot of things
possible.
-josh
On Tuesday, June 17, 2003, at 5:20, Sebastian Mecklenburg wrote:
hello,
i wrote a simple client-server software in c++ and the usual unix
socket functions to transfer some data via tcp. it works fine with
ipv4 but with ipv6 the connect() function always generates a "no rout
to host" error, if server and client are on different computers. if
both are on the same machine (i.e. both use ::1 as address) it works
fine. here is the code i use, it's the constructor of mysocket class:
//create a client
Socket::Socket(const char* in_hostname, const char* in_portnumber) :
m_socketDescriptor(-1),
m_isServer(false) {
int err = 0;
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0; //AI_PASSIVE (not for clients)
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_STREAM;
err = ::getaddrinfo(in_hostname, in_portnumber, &hints, &res);
//no error here
m_socketDescriptor = ::socket(res->ai_family, res->ai_socktype,
res->ai_protocol);
if(m_socketDescriptor < 0) {
//no error here
}
// Connect to the server
err = ::connect(m_socketDescriptor, res->ai_addr, res->ai_addrlen);
//duh! err is -1 and errno is 65, which stands for "no route to
host'"
}
for in_hostname parameter i use the ipv6 ip address of the server,
which is automatically generated from the MAC address of the network
devices and is shown by ifconfig, for example
fe80::230:65ff:fe17:8f20. someone got an idea?
regards,
sebastian mecklenburg
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.