Specific IP address use
I converted my linode over to IPv6 a little while ago and recieved a pool of 4096 addresses from linode as well. I have added a few of these addresses to my linode using the guide shown, but I have some questions for ways to use them.
What I really want to do is select which IP to use as my main IP. I currently have three IPv6 addresses on eth0 on my Arch Linux linode. Is there a way that I could, for example, run Firefox using IP 1, close it, then run Firefox using IP 2? Like,
If you still don't understand what I'm asking, I'm basically trying to swap the IP my linode uses as it's main external IP for a different one.
7 Replies
The system-wide method I use is marking certain addresses as deprecated
auto eth0
iface eth0 inet static
address 67.18.187.111
gateway 67.18.187.1
netmask 255.255.255.0
up ip addr add 192.168.130.4/17 dev eth0
down ip addr del 192.168.130.4/17 dev eth0
up ip addr add 2600:3c00::2:b001/64 dev eth0
down ip addr del 2600:3c00::2:b001/64 dev eth0
up ip addr add 2600:3c00::2:b101/64 dev eth0 preferred_lft 0
down ip addr del 2600:3c00::2:b101/64 dev eth0
up ip addr add 2600:3c00::2:b401/64 dev eth0 preferred_lft 0
down ip addr del 2600:3c00::2:b401/64 dev eth0
N.B.: I don't mark the autoconfigured EUI-64 address (i.e. 2600:3c00::f03c:91ff:fe96:6bcc in my case) as deprecated. It shouldn't ever get used as the default source address anyway, since it's added before my other addresses, but I don't mind if it does, so I make no effort to prevent it. If I wanted to do so, something like this would work:
up ip addr change 2600:3c00::f03c:91ff:fe96:6bcc dev eth0 preferred_lft 0
I'm sure Arch has a different style of networking configuration, but this should give you an idea – and it's always possible to stick iproute2 commands somewhere.
(Or am I way off track now?)
@hawk7000:
Wouldn't it be a more "appropriate" way of doing this to, for ipv4 and ipv6 alike, use the policy routing facilities? (Also set up through the ip command)
(Or am I way off track now?)
Probably, but I didn't know about that when I first set it up, and I still haven't read up on how to do it. And I think my iproute2 is too old anyway.
[root@li224-139 squid]# ip -6 addr show
1: lo: <loopback,up,lower_up>mtu 16436
inet6 ::1/128 scope host deprecated
valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast,up,lower_up>mtu 1500 qlen 1000
inet6 2600:3c01::1b:6ffd/64 scope global
valid_lft forever preferred_lft forever
inet6 2600:3c01::1b:6fff/64 scope global deprecated
valid_lft forever preferred_lft forever
inet6 2600:3c01::f03c:91ff:fe93:b047/64 scope global deprecated
valid_lft forever preferred_lft forever
inet6 fe80::f03c:91ff:fe93:b047/64 scope link deprecated
valid_lft forever preferred_lft forever
[root@li224-139 squid]# lynx -dump 'http://seemyip.com'|grep "What is my IP?"
What is my IP? 173.255.214.139([2]ARIN Lookup)
[root@li224-139 squid]# ip -6 addr change 2600:3c01::1b:6ffd/64 dev eth0 preferred_lft 0
[root@li224-139 squid]# ip -6 addr show
1: lo: <loopback,up,lower_up>mtu 16436
inet6 ::1/128 scope host deprecated
valid_lft forever preferred_lft forever
2: eth0: <broadcast,multicast,up,lower_up>mtu 1500 qlen 1000
inet6 2600:3c01::1b:6ffd/64 scope global deprecated
valid_lft forever preferred_lft forever
inet6 2600:3c01::1b:6fff/64 scope global deprecated
valid_lft forever preferred_lft forever
inet6 2600:3c01::f03c:91ff:fe93:b047/64 scope global deprecated
valid_lft forever preferred_lft forever
inet6 fe80::f03c:91ff:fe93:b047/64 scope link deprecated
valid_lft forever preferred_lft forever
[root@li224-139 squid]# lynx -dump 'http://seemyip.com'|grep "What is my IP?"
What is my IP? 173.255.214.139([2]ARIN Lookup)</broadcast,multicast,up,lower_up></loopback,up,lower_up></broadcast,multicast,up,lower_up></loopback,up,lower_up>
Try
lynx --dump http://www.whatismyipv6.net/ | grep 'Your IP'
@sweh:
Your lynx connection is using IPv4. "seemyip.com" doesn't have an IPv6 address so you can't use it for this test.
Try
lynx --dump http://www.whatismyipv6.net/ | grep 'Your IP'
So if you check my IP using IPv4 no matter what IPv6 address I'm using it'll return the same IP?
Unless you pay for extra, you only have one IPv4 address and all IPv4 connections you make will use that address. No matter what you do with IPv6.