Please note: this is not the already-answered "IPv6 bridging+IPv4 NATing" question, but instead a "IPv6 bridging+DHCPv4 client on eth0+DHCPv4 server on wlan0" question.
For IPv4/IPv6 Dual Stack and IPv6-only system tests I would like to build a very peculiar "brouter" using Linux. This brouter has two pysical network interfaces, eth0 and wlan0. I'm using a bridge br0, to which I attach eth0 and wlan0.
Now for the overall context:
eth0will be attached to either:
- an IPv6-only infrastructure with RAs that provide prefixes and DNS autoconfiguration, or alternatively
- an IPv6/IPv4 "home" network that has an IPv4/IPv6 router, offers IPv6 prefixes and DNS autoconfig, as well as DHCPv4 for address and DNS autoconfig.
wlan0works in Access Point mode, to which wireless devices will later connect to, such as smartphones. These devices shall get full IPv6 connectivity, but only "limited" (local) IPv4 connectivity. That is, these devices should get a private IPv4 address, but there isn't any bridging or routing to the
eth0side when it comes to IPv4.
In view of the IP address families:
- IPv6: this is straightforward using
ebtables, because I just need to enable bridging of IPv6-typed Ethernet frames between all bridge ports. The bridge itself gets a SLAAC address using RAs received via
eth0, as get all the mobile devices too.
- IPv4: now that's where I'm slightly lost at the moment, because I want to achieve this slightly tricky behavior:
br0 should get an autoconfigured IPv4 address via DHCPv4 from the
eth0 side, if there's a DHCPv4 server available, otherwise fall back to a static IPv4. So there's a DHCPv4 client that autoconfigures
br0 at the moment.
eth0 should offer a DHCPv4 server to the attached mobile devices only. In particular, the bridge-local DHCPv4 client should not get its IPv4 configuration from the local DHCPv4 server.
The rationale for wanting a DHCPv4 client on eth0 is that I need to ssh into box for maintenance, and that is best done in a "home" network environment, but I need to switch between multiple home networks with different address ranges, so I cannot use a static configuration.
How can I run the DHCPv4 client and server on the same host, yet have them serve separate IP subnets/"segments"? Is this achievable using ebtables? Do I need to attach the client and server to the physical network interfaces instead in order to achieve my goal? If so, how is this done correctly, if that is sensible at all?