On Tue, Aug 26, 2008 at 3:08 PM, Phil Meyer pmeyer@themeyerfarm.com wrote:
Alan Evans wrote:
On Tue, Aug 26, 2008 at 1:40 PM, Phil Meyer pmeyer@themeyerfarm.com wrote:
The file: /etc/sysconfig/static-routes is optional, and does not exist by default.
#This line forces multicast out of eth1 # any: net 224.0.0.0 netmask 240.0.0.0 dev eth1 # for the lab, uncomment the next two lines # This line forces a route to the local network # any: net 10.0.0.0 netmask 255.0.0.0 dev eth0 # This line will force a specific network over the primary interface # any: net NNN.NNN.0.0 netmask 255.255.0.0 dev eth0
Still no joy. But I'm still not sure I got it right. All of the examples seem to demonstrate routing a particular network through a particular interface. I only have one interface on this machine; what I wish to do is specify a particular gateway for use for a particular address. I tried:
any: net NNN.NNN.NNN.NNN netmask 255.255.255.255 gateway 192.168.0.3
as a guess, but nothing changed. Nothing in any log that I could find seemed to indicate whether NetworkManager was even trying to read this file.
Well, for a single host, it would be something like this:
any: host 10.10.10.10 gateway 192.168.1.1
But the question is still whether or not NetworkManager will obey this file.
Still nothing at this point.
Worst case scenerio we can write a NM dispatcher script to do it:
in: /etc/NetworkManager/dispatcher.d/
create a file called static, chmod 755 static, and add: (NOT tested): I ripped the section from /etc/init.d/network.
#!/bin/sh
interface=$1 state=$2
case $state in up) # Add non interface-specific static-routes. if [ -f /etc/sysconfig/static-routes ]; then grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do /sbin/route add -$args done fi ;;
down) ;;
Well, this produces at least an error in /var/log/messages:
Aug 28 08:01:02 localhost nm-dispatcher.action: Script '/etc/NetworkManager/dispatcher.d/static' exited with error status 2.
So that's something, anyway. I don't see any errors in the script, but I confess that I'm a second-rate bash scripter.