Unix Technical Forum

service listener for both IPv4 and IPv6

This is a discussion on service listener for both IPv4 and IPv6 within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> Hi, How do we make service both listening to ipv4 and ipv6 in unix. Do we need to create ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2008, 10:18 PM
Panduranga Chary
 
Posts: n/a
Default service listener for both IPv4 and IPv6

Hi,


How do we make service both listening to ipv4 and ipv6 in unix.


Do we need to create two sockets (1 for v4 and 1 for v6) and listen on
both as in windows XP.

or

For inted initiated service.

we are putting 2 entries (1 for v4 and 1 for v6) though the binary is
same. only single socket opened and address binds to first accepted
address from a call to getaddrinfo().


/etc/services


tcp service #v4
tcp6 service


/etc/inetd.conf
service stream tcp nowait root service_path service
service stream tcp6 nowait root service_path service


Could you please suggest. How we go about it.

Thanks
Panduranga Chary
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-21-2008, 10:18 PM
Casper H.S. Dik
 
Posts: n/a
Default Re: service listener for both IPv4 and IPv6

Panduranga Chary <pr.chary@gmail.com> writes:

>How do we make service both listening to ipv4 and ipv6 in unix.


In Solaris, you create a single IPv6 socket and it will accept
both IPv4 and IPv6 traffice destined for that specific port.

>we are putting 2 entries (1 for v4 and 1 for v6) though the binary is
>same. only single socket opened and address binds to first accepted
>address from a call to getaddrinfo().



>/etc/services



>tcp service #v4
>tcp6 service


/etc/services does not distinguish between IPv6 and IPv4 ports; for
all intents and purposes they are the same.


>/etc/inetd.conf
>service stream tcp nowait root service_path service
>service stream tcp6 nowait root service_path service


No, just:

service stream tcp6 nowait root service_path service

though it is posisble to use both (in which case separate daemons get
started.


Note that when you use the single socket approach all IPv4 connections
will appear as "IPv4 mapped" addresses.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-21-2008, 10:18 PM
Tristram Scott
 
Posts: n/a
Default Re: service listener for both IPv4 and IPv6

Panduranga Chary <pr.chary@gmail.com> wrote:
> How do we make service both listening to ipv4 and ipv6 in unix.
>
>
> Do we need to create two sockets (1 for v4 and 1 for v6) and listen on
> both as in windows XP.


The man page for socket lists separate protocol families for each, so I
think that yes, you need a socket for each:

int f1, f2;
f1 = socket(PF_INET, SOCK_STREAM, 0); /* create the socket */
f2 = socket(PF_INET6, SOCK_STREAM, 0); /* create the socket */
...

>
> For inted initiated service.
>
> we are putting 2 entries (1 for v4 and 1 for v6) though the binary is
> same. only single socket opened and address binds to first accepted
> address from a call to getaddrinfo().
>
>
> /etc/services
>
>
> tcp service #v4
> tcp6 service
>
>
> /etc/inetd.conf
> service stream tcp nowait root service_path service
> service stream tcp6 nowait root service_path service
>


Did you run inetconv after making changes to /etc/inetd.conf?
inetd.conf is no longer directly used by Solaris. If you update the
inetd.conf file then you will need to use inetconv(1M) to import the new
records into the smf repository.

--
Dr Tristram J. Scott
Energy Consultant
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-21-2008, 10:18 PM
James Carlson
 
Posts: n/a
Default Re: service listener for both IPv4 and IPv6

Casper H.S. Dik <Casper.Dik@Sun.COM> writes:
> Panduranga Chary <pr.chary@gmail.com> writes:
>
> >How do we make service both listening to ipv4 and ipv6 in unix.

>
> In Solaris, you create a single IPv6 socket and it will accept
> both IPv4 and IPv6 traffice destined for that specific port.


Although this is true, I would not recommend designing an application
to work this way. Instead, opening separate sockets for v4 and v6
(using the IPV6_V6ONLY option for the latter) is the recommended way
to go.

See the notes in PSARC 2006/466; we had a lengthy discussion with Erik
Nordmark about this, and the bottom line is that the transition
mechanisms don't work particularly well for anything other than the
most trivial of applications.

--
James Carlson, Solaris Networking <james.d.carlson@sun.com>
Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 05:31 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com