= NetApp: Add Route =
**Summary**: How to setup a network route on a Netapp Filer. \\
**Date**: Around 2015 \\
**Refactor**: 7 March 2025: Checked links and formatting. \\
{{tag>netapp}}
This is small howto on routing on ONTAP, the NetApp OS. The goal is to add a (default) route and check the current route.
= Check Current Routes =
First, check the current route on the filer:
filer2> netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Interface
default 10.100.250.1 UGS 3 538323776 e0M
10.100.150/24 link#2 UC 0 0 e0a
10.100.250/24 link#1 UC 0 0 e0M
10.100.250.1 0:0:c:7:ac:96 UHL 1 0 e0M
10.100.250.101 0:a0:98:29:38:34 UHL 0 0 e0M
10.100.250.231 0:50:56:b9:0:51 UHL 1 1 e0M
127 127.0.0.1 UGS 0 5674 lo
127.0.0.1 127.0.0.1 UH 3 16075 lo
198.15.1 link#3 UC 0 0 e0b
Than add the route, telling that network 10.100.170 can be reached over gateway 10.100.150.1:
filer2> route add net 10.100.170/24 10.100.150.1 1
add net 10.100.170/24: gateway 10.100.150.1
Than recheck the routes:
filer2> netstat -rn
Routing tables
Internet:
Destination Gateway Flags Refs Use Interface
default 10.100.250.1 UGS 5 538323808 e0M
10.100.150/24 link#2 UC 0 0 e0a
10.100.150.1 link#2 UHL 1 0 e0a
10.100.170/24 10.100.150.1 UGS 0 0 e0a
10.100.250/24 link#1 UC 0 0 e0M
10.100.250.1 0:0:c:7:ac:96 UHL 1 0 e0M
10.100.250.101 0:a0:98:29:38:34 UHL 0 0 e0M
10.100.250.231 0:50:56:b9:0:51 UHL 1 1 e0M
127 127.0.0.1 UGS 0 5674 lo
127.0.0.1 127.0.0.1 UH 3 16075 lo
198.15.1 link#3 UC 0 0 e0b
Now make it permanent by adding the route to the /etc/rc file:
First, read the file:
filer2> rdfile /etc/rc
#Regenerated by registry Tue Apr 19 16:36:30 GMT+02:00 2011
#Auto-generated by setup Tue Mar 8 16:08:22 GMT 2011
hostname filer2
ifconfig e0M `hostname`-e0M flowcontrol full netmask 255.255.255.0 partner e0M netmask 255.255.255.0
ifconfig e0a `hostname`-e0a mediatype auto flowcontrol full netmask 255.255.255.0 partner e0a netmask 255.255.255.0
route add default 10.100.250.1 1
routed on
options dns.enable on
options nis.enable off
savecore
Then, recreate the file so you can edit it:
filer2> wrfile /etc/rc
#Regenerated by registry Tue Apr 19 16:36:30 GMT+02:00 2011
#Auto-generated by setup Tue Mar 8 16:08:22 GMT 2011
hostname filer2
ifconfig e0M `hostname`-e0M flowcontrol full netmask 255.255.255.0 partner e0M netmask 255.255.255.0
ifconfig e0a `hostname`-e0a mediatype auto flowcontrol full netmask 255.255.255.0 partner e0a netmask 255.255.255.0
route add default 10.100.250.1 1
routed on
route add net 10.100.170/24 10.100.150.1 1
options dns.enable on
options nis.enable off
savecore
read: error reading standard input: Interrupted system call
Recheck the file:
filer2> rdfile /etc/rc
#Regenerated by registry Tue Apr 19 16:36:30 GMT+02:00 2011
#Auto-generated by setup Tue Mar 8 16:08:22 GMT 2011
hostname filer2
ifconfig e0M `hostname`-e0M flowcontrol full netmask 255.255.255.0 partner e0M netmask 255.255.255.0
ifconfig e0a `hostname`-e0a mediatype auto flowcontrol full netmask 255.255.255.0 partner e0a netmask 255.255.255.0
route add default 10.100.250.1 1
routed on
route add net 10.100.170/24 10.100.150.1 1
options dns.enable on
options nis.enable off
savecore
filer2>
= Change Default Route =
To change the default route you can change the /etc/rc file and issue these commands:
filer1> route delete default
delete net default
filer1> route add default 10.100.250.1 1
add net default: gateway 10.100.250.1
> Note: You can do this remotely, you won't loose your connection over this.