forked from DGNum/liminix
mt300a: use module-based network services for lan/wan
This commit is contained in:
parent
f1dfb1f976
commit
b094220466
1 changed files with 34 additions and 21 deletions
|
@ -55,28 +55,41 @@
|
||||||
"${openwrt.src}/target/linux/ramips/dts"
|
"${openwrt.src}/target/linux/ramips/dts"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
networkInterfaces = rec {
|
networkInterfaces =
|
||||||
# lan and wan ports are both behind a switch on eth0
|
let
|
||||||
eth = interface { device = "eth0"; };
|
inherit (config.system.service.network) link;
|
||||||
lan = interface {
|
inherit (config.system.service) vlan;
|
||||||
type = "vlan";
|
inherit (pkgs.liminix.services) oneshot;
|
||||||
device = "eth0.1";
|
swconfig = oneshot {
|
||||||
link = "eth0";
|
name = "swconfig";
|
||||||
id = "1";
|
up = ''
|
||||||
dependencies = [eth];
|
PATH=${pkgs.swconfig}/bin:$PATH
|
||||||
|
swconfig dev switch0 set reset
|
||||||
|
swconfig dev switch0 set enable_vlan 1
|
||||||
|
swconfig dev switch0 vlan 1 set ports '1 2 3 4 6t'
|
||||||
|
swconfig dev switch0 vlan 2 set ports '0 6t'
|
||||||
|
swconfig dev switch0 set apply
|
||||||
|
'';
|
||||||
|
down = "swconfig dev switch0 set reset";
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
eth = link.build { ifname = "eth0"; dependencies = [swconfig]; };
|
||||||
|
# lan and wan ports are both behind a switch on eth0
|
||||||
|
lan = vlan.build {
|
||||||
|
ifname = "eth0.1";
|
||||||
|
primary = eth;
|
||||||
|
vid = "1";
|
||||||
|
};
|
||||||
|
wan = vlan.build {
|
||||||
|
ifname = "eth0.2";
|
||||||
|
primary = eth;
|
||||||
|
vid = "2";
|
||||||
|
};
|
||||||
|
wlan = link.build {
|
||||||
|
ifname = "wlan0";
|
||||||
|
dependencies = [ mac80211 ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
wan = interface {
|
|
||||||
type = "vlan";
|
|
||||||
device = "eth0.2";
|
|
||||||
id = "2";
|
|
||||||
link = "eth0";
|
|
||||||
dependencies = [eth];
|
|
||||||
};
|
|
||||||
wlan = interface {
|
|
||||||
device = "wlan0";
|
|
||||||
dependencies = [ mac80211 ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
loadAddress = "0x00A00000";
|
loadAddress = "0x00A00000";
|
||||||
|
|
Loading…
Reference in a new issue