Get IPv6 address (with DHCPv6) for a command-line interface

Hey guys, I'm a bit stucked with something for the last 2-3 days.

I have an APU3C4 which is running a custom build (the last one), with an 802.11p patch applied to have 5900MHZ channels enabled. I've created an interface with the command line (with an script), called "wlan0" and with the following parameters:

iw reg set DE
iw dev wlan0 set type ocb
ip link set wlan0 up
iw dev wlan0 ocb join 5900 10MHZ

As you can see, the mode is OCB (out of context bss). I have to create this interface using the command line because some parameters, for example 10MHZ are not admited in /etc/config/wireless. I have tested this wlan0 interface with ipv4, and it's working, it pings to another APU3C4 with the same interface (and channel, mode.. etc)

My problem at the moment is that I can't get an IPv6 address on wlan0 using DHCPv6. I have IPv6 enabled and DHCPv6 working because my LAN interface (eth1) got an IPv6 address.

In /etc/config/network, for eth1, i just set proto 'dhcpv6' and it correctly gets an address the next time I reset the network. But I don't know why is not the same for wlan0, maybe because it's created using the terminal?

As you can see in the next image, the interface is correctly configured:

iwdev

I've also tried to define this interface in the /etc/config/wireless file, creating the device/wifi-iface and trying to customize it later with the parameters but no success at all.

I don't know what more to do :pensive:. Is there a way to give that wlan0 interface a global ipv6 address? (using command line or files, if possible, because LuCi can't help me with that task I think.

Trying to create a bridge with two legs - #2 by vgaetera

Thank you for your reply but I think that, in my case, is not a name problem, right? Is not about assign the wifi-iface to a bridge, because I have nothing on /etc/config/wireless. Or is possible to define the wifi-iface in a "basic way" and add my parameters later for this interface via command-line?

You could do it statically if you know the prefix, or you could use the kernel accept RA parameters and have the kernel do slaac.

The "accept_ra" and "autoconf" parameters are enabled in /proc/sys/net/ipv6 but when a Router Advertisement comes (i saw them with tcpdump from time to time) after that still no ipv6 global address for the interface.

Set accept_ra to 2 otherwise it will be ignored on a router (with ip forwarding enabled)

I have it on "1", is not that like "on"?

Not on a router. it must be 2 on a router.

Okay, mine is not a router so it's fine I think.

What makes it a router is whether it has the ip_forwarding sysctl set. If this is set then accept_ra must be 2

Oh, okay! I had it on 1, yeah, so I have to change accept_ra parameter to 2.

By the way, I "linked" wlan0 with lan in a bridge, so "br-lan" now is a bridge between eth1-wlan0. Is that the right way to make dhcpv6 work on wlan0 as @vgaetera said?

If you want them to be on the same IP subnet then that is how to do it, and then the bridge gets an ip address each "port" in the bridge just acts as a layer 2 device.

1 Like

Yes, that's what I want!

I've read that is "impossible" to bridge a wireless interface to a wired one, but that's actually working right? I mean, if I get packets from the wlan0 interface via 802.11p, those packets go through the bridge to the eth1 interface?

it's not possible to bridge a wireless client to an ethernet interface properly without WDS, but you can bridge a wireless AP just fine. It's not clear to me what exactly you're doing here.

2 Likes

I have two APU3C4 with OpenWRT. One in a room, one in another.

I want them to communicate with 802.11p. The interface wlan0 is created to support 802.11p, so that's working actually (cause I patched the kernel).

I'll let you a diagram of my scenario.

  • Room's A machine: Only 802.11p
  • Room's B machine: wlan0 with 802.11p and eth1 (bridged to wlan0, i guess)

The room B has a server which gives (via eth1) the ipv6 address to machine B.

Problems:

  • How can I get ipv6 address on A machine
  • Will I be able to communicate between A and B?

By the way, actual "ifconfig" output (machine B):

Ops... looks that the bridge between eth1-wlan0 is not working... at least "brctl show" is telling that wlan0 is not linked to the bridge or that doesn't belong to it.

Captura de pantalla de 2021-01-19 17-46-56

Sorry for all the messages, I'm just completing the information with files output. That's my /etc/config/network (where the bridge is defined).

A

Do you plan to bridge A to ethernet so that other devices in that room can use the same network? Or is it just one device A that needs to communicate to B?

If just A needs to talk to B, then A is just a client of the B which is set up in access point mode and bridged to ethernet. That works fine, and is standard for how OpenWrt does wireless. A should just get ipv6 addresses if it's set up to accept_ra. A does NOT need to have ip_forwarding enabled so accept_ra=1 should work.

if A needs to bridge to further ethernet clients, then you need WDS mode on both A and B, and you should put a bridge on the A wlan combined with the A ethernet. It's not clear whether WDS mode is available for this 802.11p drivers. If this is the case again, you're bridging not routing so ip_forwarding is off, and accept_ra=1 would work.

On B presumably ip_forwarding is on, but it seems like by bridging it into the bridge you've got things fixed there.

Remove wlan0 from the ifname option.
You only need to specify the network option in the wireless config.