Stop ifconfig from adding an ipv6 address? - Networking
This is a discussion on Stop ifconfig from adding an ipv6 address? - Networking ; 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 ...
-
Stop ifconfig from adding an ipv6 address?
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. I.e. the command:
ifconfig eth0 inet 192.168.1.10 up
will cause both the ipv4 address and also an ipv6 address to
materialise on eth0.
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?
If I do an 'ifconfig eth0 del /' to delete
the ipv6 address then the Java application works as it used to, stuck
back in ipv4 land.
My question is - how can I stop ifconfig from setting up an ipv6
address *automatically*? I can't see any obvious 'do not set up ipv6
by default' option in its man page. I thought by specifying 'inet'
explicitly when I 'up' it, as per my example command above,
would stop it from adding the ipv6 address ... but it doesn't. So
my startup scripts have to be a bit less elegant and run ifconfig
a second time to delete the ipv6 address once it's added the ipv4
address. I would have hoped there was a way to stop ifconfig from
doing its ipv6 thing.
As a second question, out of curiosity, can anyone give me tips
on why my Java program can't set ToS when it's using ipv6 (by
default)? 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
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?
Thanks,
Brad
-
Re: Stop ifconfig from adding an ipv6 address?
Brad wrote:
> My question is - how can I stop ifconfig from setting up an ipv6
> address *automatically*? I can't see any obvious 'do not set up ipv6
> by default' option in its man page. I thought by specifying 'inet'
I don't no slackware but on rh and derived , mandriva ...
you could put in interface configuration
NETWORKING_IPV6= false
and you could put in /etc/modprobe.conf
ailas net-pf-10 off
-
Re: Stop ifconfig from adding an ipv6 address?
Philippe Weill wrote:
> Brad wrote:
>
>> My question is - how can I stop ifconfig from setting up an ipv6
>> address *automatically*? I can't see any obvious 'do not set up ipv6
>> by default' option in its man page. I thought by specifying 'inet'
>
> you could put in interface configuration
>
> NETWORKING_IPV6= false
>
> and you could put in /etc/modprobe.conf
>
> ailas net-pf-10 off
I guess I could do that; cut it off at the source! Either disable
ipv6 when I compile the kernel, or ensure that the ipv6 module
isn't loaded.
It just seems to me that it would have been nice to have an option
to tell ifconfig to ignore ipv6 for a particular interface, rather
than wait for it to attach the ipv6 address and then have to delete it.
After posting this I did some more research and discovered that a
formal bug has been raised for the Java problem - bug ID 4792724,
since December 2002, still 'in progress'! So that's confirmed.
Brad
-
Re: Stop ifconfig from adding an ipv6 address?
On Thu, 28 Feb 2008 13:18:05 +1000, Brad wrote:
>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. I.e. the command:
>
> ifconfig eth0 inet 192.168.1.10 up
>
>will cause both the ipv4 address and also an ipv6 address to
>materialise on eth0.
I suggest that you post this question in alt.os.linux.slackware or
alt.linux.slakware.
This does not happen to me when I use rc.inet1 and rc.inet1.conf,
regardless of static or DHCP IP, and I have not done anything that
would discourage IPv6 other than to remove all references to it from
the netfilter/iptables stuff in the kernel.
Another alternative might be to use ip rather than ifconfig.
--
buck
-
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 /' 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.