This article covers the topic of interface-specific IPv6 forwarding configuration in Ubuntu 22.04, focusing on the eth0 and tap0 network interfaces. It will provide a detailed context of the topic, including key concepts, subtitles, paragraphs, and code blocks. By the end of this article, you will have a solid understanding of how to configure IPv6 forwarding between two hosts using a router with Ubuntu 22.04 as the operating system.
Understanding IPv6 Forwarding
IPv6 forwarding, also known as routing, is the process of transmitting network packets from one network to another. This is especially useful in a setup where there are multiple networks involved, such as the scenario of two hosts connected through a router.
Prerequisites
Before diving into the configuration, ensure that you have two hosts connected to a router, with one of the hosts running Ubuntu 22.04. For our example, we will refer to the router as router and the two hosts as host1 and host2. The eth0 interface on host1 will be connected directly to the router, while the tap0 interface on the router will be connected to host2.
Configuring IPv6 Addresses
In order for IPv6 forwarding to work, both hosts and the router need to be configured with the appropriate IPv6 addresses.
Host1
On host1, run the following command to configure the eth0 interface with the link-local IPv6 address:
sudo ip addr add fe80::1/64 dev eth0
Router
On the router, configure the tap0 interface with the link-local IPv6 address:
sudo ip addr add fe80::2/64 dev tap0
Host2
Lastly, on host2, configure the eth0 interface with the link-local IPv6 address:
sudo ip addr add fe80::3/64 dev eth0
Enabling IPv6 Forwarding on the Router
Now that the IPv6 addresses have been configured, it's time to enable IPv6 forwarding on the router. This is done by editing the /etc/sysctl.conf file:
sudo nano /etc/sysctl.conf
Uncomment or add the following line:
net.ipv6.conf.all.forwarding=1
Save and exit the file, then reload the sysctl configuration:
sudo sysctl -p
Configuring IPv6 Routes on Host1
To allow host1 to send IPv6 packets to host2 via the router, run the following command on host1:
sudo ip -6 route add host2's\_ipv6\_address dev eth0
Testing the Connection
With the configuration complete, let's test the connection between the two hosts.
Host1
On host1, try pinging host2 using its IPv6 address:
ping6 host2's\_ipv6\_address
Host2
On host2, you should see the incoming ICMPv6 packets from host1.
In this article, we discussed interface-specific IPv6 forwarding configuration in Ubuntu 22.04, focusing on the eth0 and tap0 network interfaces.
We covered the prerequisites for the configuration, including a router and two hosts with corresponding network interfaces.
We then walked through the process of configuring IPv6 addresses for the router and the hosts.
We enabled IPv6 forwarding on the router and configured the necessary IPv6 routes on host1.
Finally, we tested the connection between the two hosts using ICMPv6 ping packets.