![]() Freebsd.org OpenPacket Blog
30/08/2005
03/09/2005
06/09/2005
09/09/2005
10/09/2005
03/10/2005
|
UML and IPv6
UML and IPv6
As part of my "ipv6 everywhere" goal, and given the "let's offer User Mode Linux instances to people" project, I decided to do both at the same time, with the net result of UML instances available, each with their own /64. Many thanks to the heanet people for their help. Each UML has one IPv4 address and a /64 IPv6 allocation and these need to be routed to each. Since I don't have native IPv6 to the network (yet), I have a 6in4 tunnel, with the host acting as the endpoint and router. radvd is also running on the host, advertising a /64 to each tap interface. We ensure that the host routes each address to the correct tap device and that IP forwarding is on. First we need to create the tap device and ensure that the UML has sufficient privileges to use it. chmod 666 /dev/net/tun tunctl -t tap0 -u uml-user The above will give full read-write permissions to /dev/net/tun, and create a new tap device for the user 'uml-user'. We must assign the tap an IPv4, so that it may be used for routing. New tap devices are automatically given IPv6 link-local addresses, so there is no need to add one. ifconfig tap0 up 217.114.172.200 netmask 255.255.255.255 We assign the host's ip address (in this case, the same as eth0) to the tap device eth0 is already configured as 217.114.172.200. This is the linux equivalent of ip unnumbered. IPv4 There are some steps to perform to get IPv4 routing working. IPv4 forwarding must be turned on so that the host will forward the packets echo 1 > /proc/sys/net/ipv4/ip_forward We need to route the UMLs ip address down the actual interface: ip route add 217.114.172.205 dev tap0 And then we need to turn on proxy arping so that the host will respond to arp requests for that address echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp Now, as we route a /32 to each UML, they have in effect no LAN. There is no broadcast and do not have a gateway. For this to work, the UML must default route to a device. Inside the UML, you will need to run a command like: /sbin/route add default eth0 IPv6 First of all, enable IP forwarding echo 1 > /proc/sys/net/ipv6/conf/all/forwarding We also need to route the /64 down the correct interface: ip route add 2001:770:11f:1::/64 dev tap0 Since tap device link addresses do not persist accross reboots, there is no way to staticly configure a gateway on the UML for IPv6 To get around this, run radvd, advertising as the router for the prefix. In radvd.conf: interface tap0 { AdvSendAdvert on; prefix 2001:770:11f:1::/64; { }; }; This ensures that the UML learns a default route through icmpv6 router solicitations and advertisements. Edit: After a reboot of the host, the UML routing stopped working totally. This was fixed by enabling proxy arp for all interfaces: echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp Documento Original: http://niall.frogstomp.com/blog/archives/2004/08/05/uml-and-ipv6/ << InĂcio |