Hi, Matt. Sorry for the top post, but my iPad mail client seems averse to allowing me to bottom post. Just wanted to take a moment to note that I believe you've got things a little bit reversed. The use Of the route-ethX files and the "ip" command are the "newer" method. Setting the NETMASK and ADDRESS in the ifcfg-ethX files has always been and continues to be the norm. Having the GATEWAY field in either the ifcfg-ethX files or in /etc/sysconofig/network is the older way of setting the default route. You're right, though...it was certainly less flexible. ;-) On Dec 15, 2011, at 12:54 PM, Matt Garman <matthew.garman@xxxxxxxxx> wrote: > Adding additional info for posterity, and in case anyone else runs > across this... > > On Wed, Dec 7, 2011 at 12:28 PM, Benjamin Franz <jfranz@xxxxxxxxxxx> wrote: >> On 12/7/2011 10:03 AM, Matt Garman wrote: >>> Hi, >>> >>> [...] >>> What I basically need to be able to do is this: >>> route add -host h1 gw g1 metric 0 >>> route add -host h1 gw g2 metric 10 >>> >>> Notice that everything is the same except the gateway and metric. I could >>> put this in /etc/rc.local, but was wondering if there's a cleaner way to do >>> it in e.g. the network-scripts directory." >>> >> If you create files in the /etc/sysconfig/network-scripts directory >> named according to the scheme >> >> route-eth0 >> route-eth1 >> route-eth2 >> >> it will execute each line in the files as >> >> /sbin/ip route add <line> >> >> when each interface is brought up. >> >> Look in the /etc/sysconfig/network-scripts/ifup-routes script for all >> the gory details and features. > > I actually did just that---looked at the ifup-routes script. The > thing that threw me off is the comments about "older format" versus > "new format". I probably read into the comments too much, but I > thought to myself, "I should probably use the new format, as they > might some day deprecate the old format." > > But anyway, the "older format" is what I need. With the older format, > it's exactly what you said above: each line corresponds to running "ip > route add <line>". So what I added were lines in this format: > > <addr>/<mask> via <gateway> dev <device> metric <N> > > A contrived example might be: > > 10.25.77.0/24 via 192.168.1.1 dev eth0 metric 5 > > The "new format" is where each group of three lines corresponds to a > route. You have the ADDRESSxx=, NETMASKxx=, GATEWAYxx= lines. > Clearly this is less flexible, particularly if you need to set a > metric like me. :) > > Anyway, hopefully that's useful for anyone in a similar situation! _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx http://lists.centos.org/mailman/listinfo/centos