[SLOF] [PATCH] ipv6: Fix gcc9 warnings

Thomas Huth thuth at redhat.com
Tue Oct 22 17:33:45 AEDT 2019


On 22/10/2019 03.05, Alexey Kardashevskiy wrote:
> How do you test ipv6? I spent an hour with dnsmasq and could not get it working (ipv4 works nicely), tftp part fails.

I normally use slirp these days -- by starting QEMU with "-nic
user,ipv4=off,tftp=...,bootfile=..." or something similar.

But when I originally worked on the IPv6 support, I had a more fancy
setup with three VMs that were connected together via "-netdev socket".

In case it's of any help, these were my quick-n-dirty notes how to set
up these three VMs:


Basic idea is to hook up three VMs together with the "-netdev socket"
parameter, so that you get a virtual network setup like this:

    +--------+     +--------+     +-------------+
    | client |<--->| router |<--->| TFTP server |
    +--------+     +--------+     +-------------+
                ^              ^
                |              |
          fc00:1::/64     fc00:2::/64

Router:

qemu-system-ppc64 -enable-kvm -nographic -vga none -device
spapr-vlan,netdev=usernet,mac=02:ca:fe:00:02:01 -netdev user,id=usernet
-device e1000,netdev=ipv6net1,mac=02:ca:fe:00:02:02 -netdev
socket,id=ipv6net1,listen=:11122 -device
e1000,netdev=ipv6net2,mac=02:ca:fe:00:02:03 -netdev
socket,id=ipv6net2,listen=:12233 -hda
/var/lib/libvirt/images/dhcpv6router.qcow2

Server:

qemu-system-ppc64 -enable-kvm -nographic -vga none -device
spapr-vlan,netdev=usernet,mac=02:ca:fe:00:03:01 -netdev user,id=usernet
-device e1000,netdev=ipv6net,mac=02:ca:fe:00:03:02 -netdev
socket,id=ipv6net,connect=:12233 -hda
/var/lib/libvirt/images/dhcpv6server.qcow2

Client:

qemu-system-ppc64 -enable-kvm -nographic -vga none -device
spapr-vlan,netdev=usernet,mac=02:ca:fe:00:01:01 -netdev user,id=usernet
-device virtio-net-pci,netdev=ipv6net,mac=02:ca:fe:00:01:02 -netdev
socket,id=ipv6net,connect=:11122 -hda
/var/lib/libvirt/images/dhcpv6client.qcow2


Client:
=======

nmcli c add type ethernet ifname enp0s0 con-name enp0s0
nmcli c mod enp0s0 ipv4.method disabled ipv6.method auto
ip -6 route add fc00:2::/64 dev enp0s0 via fc00:1::1
firewall-cmd --zone=public --add-service tftp-client

Router:
=======

 yum install radvd

nmcli c add type ethernet ifname enp0s0 con-name enp0s0 ip6 fc00:1::1
nmcli c add type ethernet ifname enp0s1 con-name enp0s1 ip6 fc00:2::1
ifup enp0s0
ifup enp0s1

ip -6 route add fc00:1::/64 dev enp0s0
ip -6 route add fc00:2::/64 dev enp0s1

or:

echo "fc00:1::/64 dev enp0s0" >>
/etc/sysconfig/network-scripts/route6-enp0s0
echo "fc00:2::/64 dev enp0s1" >>
/etc/sysconfig/network-scripts/route6-enp0s1


cat /etc/radvd.conf :

 interface enp0s0
 {
	AdvSendAdvert on;
	MinRtrAdvInterval 30;
	MaxRtrAdvInterval 100;
	prefix fc00:1::/64
	{
		AdvOnLink on;
		AdvAutonomous on;
		AdvRouterAddr off;
	};

 };

 interface enp0s1
 {
        AdvSendAdvert on;
        MinRtrAdvInterval 30;
        MaxRtrAdvInterval 100;
        prefix fc00:2::/64
        {
                AdvOnLink on;
                AdvAutonomous on;
                AdvRouterAddr off;
        };

 };

systemctl enable radvd
systemctl start radvd
systemctl stop firewalld  # <- Sorry, too lazy to set this up properly
echo 1 > /proc/sys/net/ipv6/conf/all/forwarding
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf

cat /etc/dhcp/dhcpd6.conf :
 default-lease-time 2592000;
 preferred-lifetime 604800;
 dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";
 log-facility local7;
 subnet6 fc00:1::/64 {
        interface enp0s0;
        range6 fc00:1::1000 fc00:1::2000;
        option dhcp6.bootfile-url
"tftp://[fc00:2::ca:feff:fe00:302]/boot-me";
        option dhcp6.name-servers fc00:1::1;
 }

systemctl enable dhcpd6
systemctl start dhcpd6


TFTP server:
============

nmcli c add type ethernet ifname enp0s0 con-name enp0s0
nmcli c mod enp0s0 ipv4.method disabled ipv6.method auto
yum install tftp-server
systemctl enable tftp.socket
systemctl start tftp.socket
ip -6 route add fc00:1::/64 dev enp0s0 via fc00:2::1
firewall-cmd  --zone=public --add-port=tftp


 HTH,
  Thomas



More information about the SLOF mailing list