How to setup IPv6

Hi!
I have college project regarding p4. I need to implement ipv4 ↔ ipv6 translation, but I have trouble with setting up the environment :confused:

Ideally, I want to create topology with two hosts and one switch. One of the host should have ipv6 address, and switch should translate the packages between the hosts. I’ve tried modifing example from tutorials provided on github.

Here’s topology.json file I’ve tried:

{
    "hosts": {
        "h1": {
            "ip": "2001:db8:1::1/64",
            "mac": "08:00:00:00:01:11",
            "commands": []
        },
        "h2": {
            "ip": "10.0.2.2/24",
            "mac": "08:00:00:00:02:22",
            "commands": [
                "ip route add default via 10.0.2.20 dev eth0",
                "arp -i eth0 -s 10.0.2.20 08:00:00:00:02:00"
            ]
        }
    },
    "switches": {
        "s1": { "runtime_json": "pod-topo/s1-runtime.json" }
    },
    "links": [
        ["h1", "s1-p1"],
        ["h2", "s1-p2"]
    ]
}

Unfortunately, h1 does not get ipv6 address (or any ip address at all):

h1 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc netem state UP group default qlen 1000
    link/ether 08:00:00:00:01:11 brd ff:ff:ff:ff:ff:ff link-netnsid 0

MAC address seems okay, so topology file parses correctly…

I’m grateful for any input from you!

I have not worked with this recently, but my first inclination would be that you need one or more commands in the “commands” list for host “h1” that configures an IPv6 address on its eth0 interface (or whatever other interface name you would like to configure, if there are other interfaces of interest). They cannot be exactly the same as the commands for host “h2”, because those configure IPv4 addresses, not IPv6 addresses, but with a little bit of Google searching you should be able to find out the similar commands required.

FYI, running configuration comands like that only runs them on the hosts, and has no affect on the behavior of any P4 program you run on the switch(es).