Stop ifconfig from adding an ipv6 address?
- From: Brad <brad46526@xxxxxxxxx>
- Date: Thu, 28 Feb 2008 13:18:05 +1000
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 <ipv6 address>/<length>' 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
.
- Follow-Ups:
- Re: Stop ifconfig from adding an ipv6 address?
- From: Pascal Hambourg
- Re: Stop ifconfig from adding an ipv6 address?
- From: buck
- Re: Stop ifconfig from adding an ipv6 address?
- From: Philippe Weill
- Re: Stop ifconfig from adding an ipv6 address?
- Prev by Date: source based routing help needed
- Next by Date: Re: Stop ifconfig from adding an ipv6 address?
- Previous by thread: source based routing help needed
- Next by thread: Re: Stop ifconfig from adding an ipv6 address?
- Index(es):
Relevant Pages
|