Source-based routing
When using multiple interfaces on the XR2000, it is impossible to configure multiple default gateways because all the interfaces share the same routing table. To customize the interface routing, you can either configure static routes to remote hosts, or use source based routing. Source-based routing allows each interface (physical and logical) to have its own routing table, including default routes.
To configure source-based routing, you use a text editor such as vi to edit script files stored on the XR2000. Each logical interface or VLAN ID must have its own script file. Store the scripts in the following folder:
/etc/sysconfig/network-scripts
Name the scripts according to the logical interface or VLAN ID that they control. For example, to configure eth0, you edit the ifcfg-eth0 script. If a script file for the interface (or combination of VLAN ID and interface) does not already exist, you must create it in the editor.
To configure source-based routing, complete the following steps:
- Connect to XR2000 by using one of the first time setup methods, and open a console window.
- Start a text editor, such as vi.
-
Set the path to the /etc/sysconfig/network-scripts folder, and open the script for the interface that you want to configure.
Scripts are named according to the interfaces that they configure by using the following naming convention:
ifcfg-<logical_interface>.<vlanId>
Examples:
- Logical interface: To configure the logical interface eth0, edit ifcfg-eth0.
- VLAN: To configure the logical interface eth0, edit ifcfg-eth0.25.
If there is no script file for the interface (or combination of VLAN ID and interface), use the editor to create it.
-
The table below describes the parameters available for the scripts. You can also refer to the examples in this section for examples of how to configure scripts for specific configurations.
Parameter
Description BOOTPROTO= Boot-time protocol used to obtain an address for the interface:
dhcp = DHCP
none = No protocol
static = Use static address information configured in this script file
Example: BOOTPROTO=dhcp
BROADCAST= Broadcast IP address
Example: BROADCAST=192.168.1.255
DEFROUTE= Always set DEFROUTE to no, so that the default route in the default routing table will not be used.
Example: DEFROUTE=no
DEVICE= Logical interface that the script configures:
Logical interface: ethx
Example: DEVICE=eth0
VLAN interface: ethx.vlanId
Example: DEVICE=eth0.25
GATEWAY= Always set this value to null to exclude the default gateway from the default routing table.
Example: GATEWAY=””
HWADDR= MAC address of the card
Example: HWADDR=4C:02:89:00:F3:90
IPADDR= IP address of the interface (static IP addressing only)
Example: HWADDR=4C:02:89:00:F3:90
IPV6INIT= Enable IPv6 addressing on the interface.
Example: IPV6INIT=no
MACADDR= Specify a value for this parameter only if you want to spoof a MAC address.
Example: MACADDR=4C:02:89:00:F3:26
NETMASK= Network mask for IP address (static IP addressing only)
Example: NETMASK=255.255.255.0
NETWORK= Network address
Example: NETWORK=192.168.1.0
NM_CONTROLLED= Allow or deny changes from the web interface
Example: NM_CONTROLLED=yes
ONBOOT= Activate the interface at boot time
Example: ONBOOT=yes
TYPE= Interface type
Example: TYPE=Ethernet
VLAN= Enable VLAN routing on the interface
Example: TYPE=Ethernet
-
After configuring and saving the script file, you need to create separate routing tables for each logical interface that need specific default gateways.
To do this, edit the /etc/iproute2/rt_tables file, and add as many tables as you need for your configuration. For each new table, you need a table identifier and a table name.
You can use any name you want for the tables, but when using VLANs, we recommend you to use the VLAN ID and part of the table name as the table identifier. See the example below, where VLAN 25, 26 and 27 were defined over eth0.
Example:
# cat rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
25 vlan25table
26 vlan26table
27 vlan27table
-
After you create the tables, you need to add the routes and rules for each table/logical interface. To do this, you create two files in the etc/sysconfig/network-scripts folder for each table/logical interface: route-ethx and rule-ethx.
For example, assume the following:
- VLANs 25, 26 and 27 were created on top of eth0.
- The VLAN IPs are: 10.25.0.2, 10.26.0.2, and 10.27.0.2.
- The IPs' corresponding gateways are: 10.25.0.1, 10.26.0.1, and 10.27.0.1.
Under these conditions, the following files must be created:
/etc/sysconfig/network-scripts/route-eth0.25
/etc/sysconfig/network-scripts/route-eth0.26
/etc/sysconfig/network-scripts/route-eth0.27
/etc/sysconfig/network-scripts/rule-eth0.25
/etc/sysconfig/network-scripts/rule-eth0.26
/etc/sysconfig/network-scripts/rule-eth0.27
The content of /etc/sysconfig/network-scripts/route-eth0.25 would be:
default table vlan25table via 10.25.0.1
while the content of /etc/sysconfig/network-scripts/rule-eth0.25 would be:
from 10.25.0.2 table vlan25table
The route-eth0.26, route-eth0.27, rule-eth0.26, and rule-eth0.27 files should have similar content.
- When you have finished, restart the network service using the service network restart command.
Important pointers on using source based routing
-
When source-based routing is configured and you want to test the connectivity with a destination, you must use the
-Iswitch to specify the source IP that you want to use.For example, to test connectivity from interface IP 10.25.0.2 to destination IP 8.8.8.8, use: ping 8.8.8.8 –I 10.25.0.2. If 8.8.8.8 is reachable from the 10.25.0.2 interface, the ping should work. A simple ping 8.8.8.8 command will not work, even if you have internet connectivity.
-
In some cases, you may need to add a default route for the entire system. In this case, you need to add a default route to the default routing table.
To add a default route for the entire system, configure the GATEWAY parameter in one of the ifcfg-ethx files (if the interface uses a static IP address), or configure DEFROUTE=yes if the interface uses DHCP. Also, you can add routes under default routing table, using normal commands, in which you do not need to specify the name of the table.
A PPPoE connection uses the predefined default routing table and will automatically add a default route for the system.
- To display the routes corresponding to a specific table, use the following command ip route show table <table_name>.
- To display the routing rules created on the system, use the ip rule command. Make sure that there are no duplicate entries for a table.
- Inside the specific routing tables, add as many supplementary routes as you need.
- We recommend source based routing only when multiple gateways are required.
- For routing to specific destinations, use static routes instead.
- If a probe has multiple interfaces, in the Hawkeye GUI you need to add the probe multiple times, using various names, but with the same serial number. Management and test addresses must be configured in various ways, in order to match your testing requirements.