vlans and mt300a wired network interfaces
This commit is contained in:
parent
06687a819a
commit
e86e9430fc
2 changed files with 28 additions and 1 deletions
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
module = { pkgs, ...}:
|
module = { pkgs, ...}:
|
||||||
let
|
let
|
||||||
|
inherit (pkgs.liminix.networking) interface;
|
||||||
openwrt = pkgs.fetchFromGitHub {
|
openwrt = pkgs.fetchFromGitHub {
|
||||||
name = "openwrt-source";
|
name = "openwrt-source";
|
||||||
repo = "openwrt";
|
repo = "openwrt";
|
||||||
|
@ -32,6 +33,22 @@
|
||||||
"${openwrt}/target/linux/ramips/dts"
|
"${openwrt}/target/linux/ramips/dts"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
networkInterfaces = {
|
||||||
|
# lan and wan ports are both behind a switch on eth0
|
||||||
|
eth = interface { device = "eth0"; };
|
||||||
|
lan = interface {
|
||||||
|
type = "vlan";
|
||||||
|
device = "eth0.1";
|
||||||
|
link = "eth0";
|
||||||
|
id = "1";
|
||||||
|
};
|
||||||
|
wan = interface {
|
||||||
|
type = "vlan";
|
||||||
|
device = "eth0.2";
|
||||||
|
id = "2";
|
||||||
|
link = "eth0";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
boot.tftp = {
|
boot.tftp = {
|
||||||
loadAddress = "0x00A00000";
|
loadAddress = "0x00A00000";
|
||||||
|
@ -87,8 +104,16 @@
|
||||||
NET_RALINK_MDIO_MT7620 = "y";
|
NET_RALINK_MDIO_MT7620 = "y";
|
||||||
NET_RALINK_MT7620 = "y";
|
NET_RALINK_MT7620 = "y";
|
||||||
|
|
||||||
|
# both the ethernet ports on this device (lan and wan)
|
||||||
|
# are behind a switch, so we need VLANs to do anything
|
||||||
|
# useful with them
|
||||||
|
|
||||||
|
VLAN_8021Q = "y";
|
||||||
SWCONFIG = "y";
|
SWCONFIG = "y";
|
||||||
SWPHY = "y";
|
SWPHY = "y";
|
||||||
|
|
||||||
|
BRIDGE_VLAN_FILTERING = "y";
|
||||||
|
BRIDGE_IGMP_SNOOPING = "y";
|
||||||
NET_VENDOR_RALINK = "y";
|
NET_VENDOR_RALINK = "y";
|
||||||
|
|
||||||
MTD = "y";
|
MTD = "y";
|
||||||
|
|
|
@ -8,11 +8,13 @@ let
|
||||||
inherit (liminix.services) oneshot longrun;
|
inherit (liminix.services) oneshot longrun;
|
||||||
inherit (lib) concatStringsSep optional;
|
inherit (lib) concatStringsSep optional;
|
||||||
in {
|
in {
|
||||||
interface = { type ? "hardware", device, primary ? null, dependencies ? [] } @ args:
|
interface = { type ? "hardware", device, link ? null, primary ? null, id ? null, dependencies ? [] } @ args:
|
||||||
let ups =
|
let ups =
|
||||||
[]
|
[]
|
||||||
++ optional (type == "bridge")
|
++ optional (type == "bridge")
|
||||||
"ip link add name ${device} type bridge"
|
"ip link add name ${device} type bridge"
|
||||||
|
++ optional (type == "vlan")
|
||||||
|
"ip link add link ${link} name ${device} type vlan id ${id}"
|
||||||
++ ["${ifwait}/bin/ifwait -v ${device} present"]
|
++ ["${ifwait}/bin/ifwait -v ${device} present"]
|
||||||
++ ["ip link set up dev ${device}"]
|
++ ["ip link set up dev ${device}"]
|
||||||
++ optional (primary != null)
|
++ optional (primary != null)
|
||||||
|
|
Loading…
Reference in a new issue