feat(machines/ap01): add default VLAN and admin VLAN
Put DHCPv4 on the default VLAN now. Signed-off-by: Ryan Lahfa <ryan@dgnum.eu>
This commit is contained in:
parent
25eee32a22
commit
ccd89b070c
3 changed files with 40 additions and 37 deletions
|
@ -3,16 +3,18 @@ let
|
||||||
svc = config.system.service;
|
svc = config.system.service;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.dhcpv4 = svc.network.dhcp.client.build {
|
services.init-dhcpv4 = svc.network.dhcp.client.build {
|
||||||
interface = config.services.int;
|
interface = config.services.default-vlan;
|
||||||
dependencies = [
|
dependencies = [
|
||||||
config.services.bridge.components.lan
|
config.services.bridge.components.lan
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
services.defaultroute4 = svc.network.route.build {
|
services.init-defaultroute4 = svc.network.route.build {
|
||||||
via = "$(output ${config.services.dhcpv4} router)";
|
via = "$(output ${config.services.init-dhcpv4} router)";
|
||||||
target = "default";
|
target = "default";
|
||||||
dependencies = [ config.services.dhcpv4 ];
|
dependencies = [ config.services.init-dhcpv4 ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# TODO: ensure SLAAC for admin-vlan.
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,17 +8,18 @@ in
|
||||||
# TODO: support dynamic reconfiguration once we are in the target VLAN?
|
# TODO: support dynamic reconfiguration once we are in the target VLAN?
|
||||||
services.resolvconf = oneshot rec {
|
services.resolvconf = oneshot rec {
|
||||||
name = "resolvconf";
|
name = "resolvconf";
|
||||||
|
# TODO: imho, DNS should be static and provided by the router?
|
||||||
up = ''
|
up = ''
|
||||||
. ${serviceFns}
|
. ${serviceFns}
|
||||||
( in_outputs ${name}
|
( in_outputs ${name}
|
||||||
for i in $(output ${config.services.dhcpv4} dns); do
|
for i in $(output ${config.services.init-dhcpv4} dns); do
|
||||||
echo "nameserver $i" >> resolv.conf
|
echo "nameserver $i" >> resolv.conf
|
||||||
done
|
done
|
||||||
)
|
)
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
config.services.dhcpv4
|
config.services.init-dhcpv4
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,37 +3,37 @@ let
|
||||||
svc = config.system.service;
|
svc = config.system.service;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
services.int = svc.bridge.primary.build {
|
services = {
|
||||||
ifname = "int";
|
int = svc.bridge.primary.build {
|
||||||
macAddressFromInterface = config.hardware.networkInterfaces.lan;
|
ifname = "int";
|
||||||
};
|
macAddressFromInterface = config.hardware.networkInterfaces.lan;
|
||||||
|
};
|
||||||
services.bridge = svc.bridge.members.build {
|
bridge = svc.bridge.members.build {
|
||||||
primary = config.services.int;
|
primary = config.services.int;
|
||||||
members = {
|
members = {
|
||||||
lan.member = config.hardware.networkInterfaces.lan;
|
lan.member = config.hardware.networkInterfaces.lan;
|
||||||
wlan0 = {
|
wlan0 = {
|
||||||
member = config.hardware.networkInterfaces.wlan0;
|
member = config.hardware.networkInterfaces.wlan0;
|
||||||
# Bridge only once hostapd is ready.
|
# Bridge only once hostapd is ready.
|
||||||
dependencies = [ config.services.hostap-1-ready ];
|
dependencies = [ config.services.hostap-1-ready ];
|
||||||
};
|
};
|
||||||
wlan1 = {
|
wlan1 = {
|
||||||
member = config.hardware.networkInterfaces.wlan1;
|
member = config.hardware.networkInterfaces.wlan1;
|
||||||
# Bridge only once hostapd is ready.
|
# Bridge only once hostapd is ready.
|
||||||
dependencies = [ config.services.hostap-2-ready ];
|
dependencies = [ config.services.hostap-2-ready ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
default-vlan = svc.vlan.build {
|
||||||
|
ifname = "apinit";
|
||||||
|
primary = config.services.int;
|
||||||
|
vid = "0";
|
||||||
|
};
|
||||||
|
|
||||||
|
admin-vlan = svc.vlan.build {
|
||||||
|
ifname = "admin";
|
||||||
|
primary = config.services.int;
|
||||||
|
vid = "3001";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Default VLAN
|
|
||||||
# services.vlan-apro = svc.vlan.build {
|
|
||||||
# vlanId = 0;
|
|
||||||
# interface = config.services.int;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# # Administration VLAN
|
|
||||||
# services.vlan-admin = svc.vlan.build {
|
|
||||||
# vlan = 3001;
|
|
||||||
# interface = config.services.int;
|
|
||||||
# };
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue