《大中华区产品经理》由会员分享,可在线阅读,更多相关《大中华区产品经理(33页珍藏版)》请在金锄头文库上搜索。
1、Solaris 8 IPv6鄧偉文大中華區產品經理昇陽電腦nIPv6 OverviewnTransitioning to IPv6 -Philosophy and requirements -Transition tools -Scenarios -API transition - porting socket applicationsnSolaris 8 Configuration and UseOutlinenEnough address space for new Internet devices!nPlug Handles site local addressesIPv4 code I
2、Pv6/ IPv4 code int int myconnect( char *host, int port) myconnect( char *host, char *service) struct sockaddr_ in dest; struct addrinfo *res, *aip; int sock, ret; struct addrinfo hints; struct hostent *hp; int error; int s = -1;hp = gethostbyname( host); bzero( hints. ai_ flags = AI_ ADDRCONFIG; if
3、(hp = NULL | hp- h_ addrtype != AF_ INET | hints. ai_ socktype = SOCK_ STREAM;hp- h_ length != 4)error = getaddrinfo( host, service, /* Handle error */ if (error != 0) /* Handle error */ dest. sin_ family = AF_ INET; for (aip = res; aip != NULL; aip = aip- ai_ next) dest. sin_ port = htons( port); s
4、 = socket( aip- ai_ family, aip- ai_ socktype,; bcopy( hp- h_ addr, aip- ai_ protocol)if (s = -1) continue; /* Log error? */ sock = socket(AF_ INET, SOCK_ STREAM, 0); if (connect( s, aip-ai_ addr, aip-ai_ addrlen) =- 1) if (sock = -1) (void) close( s); s = -1; /* Handle error */ continue; /* Log err
5、or? */ ret = connect( sock, (struct sockaddr *) if (ret = -1) /* Handle error */ freeaddrinfo( res); return (sock); return (s); Minimal Porting of Socket ClientnNOT recommended - does not handle site local addrIPv4 code IPv6/ IPv4 code int int myconnect( char *host, int port) myconnect( char *host,i
6、nt port) struct sockaddr_ in dest; struct sockaddr_in6 dest; int sock, ret; int sock, ret; struct hostent *hp; struct hostent *hp; int errnum;hp = gethostbyname( host); hp= getipnodebyname( host, AF_ INET6, AI_ DEFAULT,if (hp = NULL | hp- h_ addrtype != AF_ INET | if (hp = NULL)hp- h_ length != 4) /
7、* Handle error */* Handle error */bzero( char *) dest.sin_ family = AF_ INET; dest.sin6_ family = hp- h_ addrtype; dest.sin_ port = htons( port); dest.sin_ port = htons( port); bcopy( hp- h_ addr, bcopy( hp- h_ addr, freehostent( hp); sock = socket(AF_ INET, SOCK_ STREAM, 0); sock = socket( AF_ INET
8、6, SOCK_ STREAM, 0); if (sock = -1) if (sock = -1)/* Handle error */ /* Handle error */ ret = connect( sock, (struct sockaddr *) ret = connect( sock, (struct sockaddr *) if (ret = -1) if (ret = -1)/* Handle error */ /* Handle error */ return (sock); return (sock); Solaris 8 IPv6 StatusnProtocol stac
9、k plus core applications -TCP/ UDP/ IP, NFS, RPC -telnet, ftp, r*, sendmail, etc -NIS and NIS+ stores IPv6 addresses. Runs over IPv6. -DNS stores IPv6 addresses. Does not run over IPv6.nBasic transition tools (RFC 1933) -Dual-stack with configured and automatic tunnelsnFuture protocol pieces -IPsec
10、for IPv6, Mobile IPv6nFuture applicationsnJDK, snmpd, apache, iPlanet, etcSolaris IPv6 API ToolsnCode scrubber (string search in source code) -See http:/ guide -See http:/arachnid.eng/inet/ipv6/ migration/index.html -Sun internal websiten(Future) “Library” to allow shrink- wrapped application binari
11、es to use new APIs on old OS releasesn(Future) shared object to allow “lucky” applications to use IPv6 without a port -Intended for “emergencies” - not to discourage portingEnabling Solaris IPv6ntouch /etc/ hostname6. le0 (for each interface) -Install tool will ask “enable IPv6” questionnreboot (or
12、re-init networking)nifconfig -a shows IPv6 addressnManually put IPv6 addresses in DNS/ NIS/. -Some day - secure dynamic DNS update -Need public key infrastructure for this -BINDv9 has much of what is neededEnabling Solaris IPv6 RouternCisco router is very similarnIn addition to the host/server steps
13、nCreate /etc/inet/ndpd. conf containing subnet prefixes prior to rebootingnNeighbor Discovery (in. ndpd) will tell the hosts their subnet address prefixesnRIPng routing protocol (in.ripngd) is run automaticallySample router ndpd. conf# Send router advertisements out all NICs ifdefault AdvSendAdverti
14、sements on # Advertise a global prefix and a # site local prefix on three interfaces. # 0x9255 = 192.146.85 prefix 2: 0: 0: 9255: 0/64 hme0 prefix fec0: 0: 0: 9255: 0/64 hme0 # 0x9256 = 192.146.86 prefix 2: 0: 0: 9256: 0/64 hme1 prefix fec0: 0: 0: 9256: 0/64 hme1 # 0x9259 = 192.146.89 prefix 2: 0: 0
15、: 9259: 0/64 hme2 prefix fec0: 0: 0: 9259: 0/64 hme2Configuring a TunnelnTunnel IPv6 in IPv4 for transition purposes between two (Solaris) routersnIn /etc/ hostname6. ip. tun0 on 129.145.45.30: -tsrc 129.145.45.30 tdst 129.146.30.45 up -addif 3ff2:8191:2d1e 3ff2:8192: 1e2d upnPlus inverse configured on 129.146.30.45Diagnosticsnifconfig -a shows all interfaces -ifconfig -a4/ ifconfig -a6 shows subsetnnetstat shows all -netstat -f inet/ netstat -f inet6 to s