routing for second interface
This commit is contained in:
parent
522efc92cc
commit
5820e7e257
1 changed files with 28 additions and 1 deletions
|
@ -81,4 +81,31 @@ in {
|
||||||
name = name;
|
name = name;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
#
|
||||||
|
networking = {
|
||||||
|
iproute2 = {
|
||||||
|
enable = true;
|
||||||
|
rttablesExtraConfig =
|
||||||
|
''1 rt2'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.secondGateway = {
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
after = [ "network.target" ];
|
||||||
|
description = "External route.";
|
||||||
|
path = [pkgs.bash pkgs.iproute];
|
||||||
|
script = ''
|
||||||
|
ip route add 193.1.96.160/28 dev eth1 src 193.1.96.165 table rt2
|
||||||
|
ip route add default via 193.1.96.165 dev eth1 table rt2
|
||||||
|
ip rule add from 193.1.96.165/28 table rt2
|
||||||
|
ip rule add to 193.1.96.165/28 table rt2
|
||||||
|
'';
|
||||||
|
serviceConfig = {
|
||||||
|
Type= "oneshot";
|
||||||
|
User = "root";
|
||||||
|
Restart = "no";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue