How Do I Add a Route?
After completing L3VPN configuration, the client needs to configure routing between network segments by registering routes to each segment of the used network through new gateway addresses.
For such a network:
- Segment machines must be connected to the dedicated networks.
- IP addresses on the interfaces must be configured.
- Segment 1 requires a route to network a.a.a.a via GW (b.b.b.254).
- Segment 2 requires a route to network b.b.b.b via GW (a.a.a.254).
route -p ADD a.a.a.a MASK 255.255.255.0 b.b.b.254 METRIC 1
- route is a program for working with routes;
- ADD is a command to add a route;
- -p key is needed to save the route;
- MASK is a network mask;
- METRIC 1 is a parameter defining the priority of the above gateway, where 1 is the highest priority.
You can check the added routes using the
route print command.
route add -net a.a.a.a netmask 255.255.255.0 gateway eth0
route add -net a.a.a.a/24 gw b.b.b.254