Re: Stop ifconfig from adding an ipv6 address?



Hello,

Brad a écrit :
Hi. I'm running Linux 2.6.23.14 with Slackware 12.0 and have had
my first exposure to ipv6. It seems that ifconfig (from net-tools
1.60) will automatically assign an ipv6 address to my ethernet
interface when I configure it for an ipv4 address, whether I want
one or not.

Is it an IPv6 link-local address, starting with fe80 ?
ifconfig is not responsible for this. The IPv6 stack is. It automatically adds a link local address to an IPv6-capable interface when the interface is brought up.

This was a problem for me, as I have a Java application which sets
the QoS/ToS bits on outgoing packets. All of a sudden that stopped
working, because the application switched over to using ipv6 sockets
on this new system. I've read that the Java folk are quite proud of
themselves for having Java use both ipv4 and ipv6 stacks by default
where both are set up on a system. And it looks like either Java -
or Linux? - can't set ToS for ipv6?

What has changed ? Is it your system or Java that did not support IPv6 before ?

If I do an 'ifconfig eth0 del <ipv6 address>/<length>' to delete
the ipv6 address then the Java application works as it used to, stuck
back in ipv4 land.

I must say I'm a bit puzzled by this.
By default Linux allows using an IPv6 socket for IPv4 communications. You could try disabling this by setting the net.ipv6.bindv6only sysctl to 0.

I wrote a simple test client in Java that simply creates
a socket to an echo daemon and sets ToS (by calling the method
'socket.setTrafficClass (0x08)'). Using strace I could see it
do this when the ipv6 address was up on the interface:

getsockname(4, {sa_family=AF_INET6, sin6_port=htons(35100), inet_pton(AF_INET6, "::", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 0
setsockopt(4, SOL_IPV6, 0x21 /* IPV6_??? */, [1], 4) = 0

What was the destination address of the echo service specified in the socket ?

Which was nicely different from the AF_INET ipv4 calls it used to
do, as a contrast. Is that setsockopt() correct, or have the Java
folk messed up? I know nothing about ipv6, but I would have assumed
there was some sort of ToS/QoS equivalent?

The IPv6 header has a "Traffic Class" field.
.



Relevant Pages

  • Re: Merging rc.d/network_ipv6 into rc.d/netif
    ... IPv6 configuration is done on each interface in rc.d/netif along with IPv4 ... IPv6 routing and options processing is done in rc.d/routing along with IPv4 ... Modify all scripts that reference old knobs to ...
    (freebsd-net)
  • Re: Merging rc.d/network_ipv6 into rc.d/netif
    ... fuller review later. ... IPv6 configuration is done on each interface in rc.d/netif along with IPv4 ... IPv6 routing and options processing is done in rc.d/routing along with IPv4 ...
    (freebsd-net)
  • Re: ipv6 connections: how?
    ... Connections with ipv6 don't seem to work. ... to its interfaces based on the interface MAC address. ... Link-local auto-configuration is analogous to 169.254.0.0/16 addresses in IPv4. ... You have no IPv6 routes. ...
    (comp.os.linux.setup)
  • Re: changing the outgoing ip address
    ... I wonder if the option to instruct Sendmail to use the inbound interface ... bound to the IPv6 address. ... IPv4 and IPv6 addresses defined in DNS, ...
    (comp.mail.sendmail)
  • The banding problem, or Pretend Youre a Router
    ... I expect there will be great interest in efficiently solving the ... It is akin to the problem of adding case ranges to Java. ... A router in IPv6 has packets coming in each labelled with an 128-bit ... If I let you design some parallel hardware, can you think of how it ...
    (comp.lang.java.programmer)