Set default gateway when configuring with static IP
This commit is contained in:
parent
e48297eb63
commit
fc8aab1136
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
eth-interface ? "eth0",
|
eth-interface ? "eth0",
|
||||||
static-ip ? false, # false, or IPv4 address
|
static-ip ? false, # false, or IPv4 address
|
||||||
|
default-gateway ? "192.168.1.1",
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
networking = if static-ip != false then {
|
networking = if static-ip != false then {
|
||||||
|
defaultGateway = { address = default-gateway; interface = eth-interface; };
|
||||||
useDHCP = false;
|
useDHCP = false;
|
||||||
interfaces.${eth-interface}.ipv4.addresses = [ {
|
interfaces.${eth-interface}.ipv4.addresses = [ {
|
||||||
address = static-ip;
|
address = static-ip;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user