How to configure multiple LAN interfaces?
Closed this issue · 4 comments
I'm trying to get multiple interfaces working. for this I've provided the interfaces in /perm/interfaces.json
:
{
"interfaces": [
{
"hardware_addr": "...",
"name": "uplink0"
},
{
"hardware_addr": "...",
"name": "lan0",
"addr": "10.0.0.1/25"
},
{
"hardware_addr": "...",
"name": "lan1",
"addr": "10.0.0.128/29"
},
{
"hardware_addr": "...",
"name": "lan2",
"addr": "10.0.0.136/29"
}
]
}
However, dhcp4d
only listens on lan0
so I can't get dynamic IPs on the other ports. Obviously this could be fixed inside dhcp4d
which would be awesome but my idea was to simply have a dhcp process running per port, supervised by gokrazy
, configure the lease path and the HTTP server. However, running multiple processes of the same instance with gokrazy doesn't seem possible, right? What would you suggest in my case?
I just noticed even with DHCP working / clients getting IPs, there is no internet access. I believe the nftables
is missing? I'm kinda new to networking/routing -- where would I need to change things to make my setup work?
My general recommendation for the scenario where you have multiple LAN ports is to bridge them together to one interface:
{
"bridges":[
{
"name": "lan0",
"interface_hardware_addrs": [
"64:9d:99:b1:fa:63",
"b8:ce:f6:2f:bf:93",
"a8:a1:59:3a:cc:53"
]
}
],
"interfaces": [
{
"hardware_addr": "b8:ce:f6:2f:aa:93",
"fec": "RS",
"name": "uplink0"
},
{
"name": "lan0",
"addr": "10.0.0.1/24"
}
]
}
Thanks, yes that solved it.
Out of curiosity, why didn't the devices on the other ports have network/internet access even when I assigned static IP addresses to them?
And what does the "fec": "RS"
do?
Out of curiosity, why didn't the devices on the other ports have network/internet access even when I assigned static IP addresses to them?
Because the networking configuration, specifically the nftables rules, only configure NAT between lan0 and uplink0, no other interfaces:
router7/internal/netconfig/netconfig.go
Lines 841 to 850 in 95fc743
And what does the
"fec": "RS"
do?
Google “fec RS” :) It’s forward error correction, which is needed for some SFP interfaces to work.