Lab 2: Add IPv6 Address to an Interface

  1. In IPv4, an interface is assigned a single IPv4 address.
  2. If you want to have multiple addresses, you need to create multiple "logical/virtual" interfaces, and assign an address on each interface.
  3. At the beginning of IPv6, it allows a single interface to possess several IPv6 addresses. This has many advantages, as we shall see in the following weeks.
  4. In this lab, we are going to manually assign an extra IPv6 address to your host.
  5. If you are using Windows, run "netsh interface ipv6 show address" to get a list of current IPv6 addresses on your NICs (network interface cards).
    
    Interface 1: Loopback Pseudo-Interface 1
    
    Addr Type  DAD State   Valid Life Pref. Life Address
    ---------  ----------- ---------- ---------- ------------------------
    Other      Preferred     infinite   infinite ::1
    
    Interface 11: Ethernet 2
    
    Addr Type  DAD State   Valid Life Pref. Life Address
    ---------  ----------- ---------- ---------- ------------------------
    Public     Preferred  29d23h59m33s 6d23h59m33s 2001:e10:6840:20:216:3eff:fe00:12
    Other      Preferred     infinite   infinite fe80::216:3eff:fe00:12%11
    
    Interface 15: Ethernet 3
    
    Addr Type  DAD State   Valid Life Pref. Life Address
    ---------  ----------- ---------- ---------- ------------------------
    Other      Deprecated    infinite   infinite fe80::209:fff:fefe:1%15
    
  6. Look for the IPv6 address with prefix "2001:e10:6840". (This is the IPv6 prefix assigned to NCNU.) Then find its interface name ("Ethernet 2" in this example).
  7. Then open another Command Prompt as administrator to run the following command: netsh interface ipv6 add address interface="Ethernet 2" 2001:e10:6840:20::YOUR_SUFFIX validlifetime=300 preferredlifetime=60
    1. To prevent your address conflicting with other students, please use your student ID as YOUR_SUFFIX. For example, if your student ID is 111321555, choose YOUR_SUFFIX to be 111:321:555.
    2. "validlifetime" is the option which defines the total time period during which the IPv6 address is valid and can be used for communication. After the valid lifetime expires, the address becomes completely unusable and is removed from the system. It defines the overall lifespan of the address, including both preferred and deprecated states.
    3. "preferredlifetime" is the time period during which the IPv6 address is in a preferred state, meaning it can be actively used for outgoing connections. After the preferred lifetime expires, the address transitions to a deprecated state. In the deprecated state, the address is still valid for receiving incoming connections, but it is no longer preferred for initiating new outbound connections. However, it can still be used for connections that were already established.
  8. Switch back to the previous Command window and run "netsh interface ipv6 show address" again. You can see that the interface "Ethernet 2" now has an extra address "2001:e10:6840:20::111:321:555".
  9. Find a partner and you two try to ping this new IPv6 address. You should find it reachable.
  10. If you did not receive ICMPv6 reply, try to ping the original address on his/her interface. If this one is not reachable either, his firewall filters out ICMPv6 packets!
  11. In "Control Panel", find "Windows Defender Firewall". Click "Advanced settings" - Inbound Rules - New Rule - Custom - Protocol and Ports [Windows Defender Firewall]
  12. You many manually delete that address by or wait until the address expires automatically after its valid life time (5 minutes in this case).
  13. If you are using FreeBSD, run "ifconfig" to find out your interface name. Suppose it is "em0" in this example.
  14. Run "ifconfig em0 inet6 2001:e10:6840:20::111:321:555/64 alias" as the superuser.
  15. Run "ifconfig em0" to verify that it has an extra IPv6 address.
  16. By default, FreeBSD does not filter out ICMPv6 packets, so you should be reachable immediately.
  17. To manually remove this address, run "ifconfig em0 inet6 2001:e10:6840:20::111:321:555/64 -alias".
  18. If you are running Ubuntu, I shall not suggest you to modify the YAML file in /etc/netplan, because that will make this IP address change permanently. (Even if you reboot the host, it will still be there.)
  19. We can use the "ifconfig" command as we did in FreeBSD. If your Ubuntu does not have "ifconfig" installed, run "apt install net-tools", this will install "ifconfig" as well as "netstat".
  20. Add the address by "ifconfig eth0 inet6 add 2001:e10:6840:20::111:321:555/64".
  21. Delete the address by "ifconfig eth0 inet6 del 2001:e10:6840:20::111:321:555/64".

Q & A

  1. Q: What would happend if I assigned an existing IPv6 address? I mean, what if the address is used by some other host?
    A: IPv6 will detect that this address duplicates with some other host, so your host would not be able to use that. In Windows, you can see its status is "Duplicate".
    
    Addr Type  DAD State   Valid Life Pref. Life Address
    ---------  ----------- ---------- ---------- ------------------------
    Manual     Duplicate          51s        51s 2001:e10:6840:20::1
    Public     Preferred  29d23h58m12s 6d23h58m12s 2001:e10:6840:20:216:3eff:fe00:12
    Other      Preferred     infinite   infinite fe80::216:3eff:fe00:12%11
    
    We shall talk more about DAD (Duplicate Address Detection) and ND (Neighbor Discovery) in future weeks.