|
#1
| |||
| |||
| Permanent Static Route Mac Os X 10.4.0 Hi friends, i want to know how I can put a static route in my system MAC OS X 10.4.0 when i restart my computer. TXS |
|
#2
| ||||
| ||||
| Would these be of any help? http://www.macosx.com/forums/archive...p/t-13926.html http://forums.macosxhints.com/archiv...p/t-33745.html To add a static route e.g.: Code: sudo route -nv add -net 192.168 -interface en0 Code: cd /System/Library/StartupItems sudo cp -R NetworkExtensions NetworkLocal cd NetworkLocal sudo mv NetworkExtensions NetworkLocal sudo vi NetworkLocal Code: #!/bin/sh
##
# Load network kernel modules
##
. /etc/rc.common
StartService ()
{
ConsoleMessage "Loading Network Local"
route -nv add -net 192.168 -interface en0
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1"
sudo vi StartupParameters.plist Code: {
Description = "Network Local";
Provides = ("NetworkLocal");
Requires = ("Network");
OrderPreference = "None";
}
cd Resources/English.lproj
sudo vi Localizable.strings Code: (?xml version="1.0" encoding="UTF-8"?) (!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd") (plist version="0.9") (dict> (key>Loading Network Local(/key) (string>Loading Network Local(/string) (/dict) (/plist) |
|
#3
| |||
| |||
| First I would like to thank Giaguara for the previous post, it has helped me more than any other I could find in setting up a persistant static route on Tiger. I did run into a few gotchas that may have to do with changes Apple has made with updates or just unknown differences in our installations so I thought I would post my method in the hopes that it might help someone else. I am assuming that anyone digging this deep into the system has probably enabled the root user so everything that follows assumes that you have opened a Terminal and typed 'su' to become root. Of course be very careful whenever doing anything as root on your system. The first problem I ran into was that there was no /System/Library/StartupItems/NetworkExtensions on my system so I did not start with a copy of something Apple provided as Giaguara did. So here we go... Code: cd /Library/StartupItems Code: mkdir AddRoutes cd AddRoutes Code: #!/bin/sh
# Set up static routing tables
# Roark Holz, Thursday, April 6, 2006
. /etc/rc.common
StartService ()
{
ConsoleMessage "Adding Static Routing Tables"
route add -net 192.168.3.0/24 192.168.0.180
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1" Code: {
Description = "Add static routing tables";
Provides = ("AddRoutes");
Requires = ("Network");
OrderPreference = "None";
} Code: chmod 755 AddRoutes StartupParameters.plist Reboot your computer and your route should be active. You can verify with a 'netstat -r' command on the Terminal. Roark Holz |
|
#4
| |||
| |||
| Thank you very much roarkh... I followed step by step the instructions you posted ... but it still doesn't work. With the netstat -r command I can see the route added in the routing table but when I try to reach the ip or the net tracert doesn't reach it. Instead if I disable the startupitem and digit in the terminal the route add command it works... What am I doing wrong or what is the tip ? I'm going mad with this ... please help me |
|
#5
| |||
| |||
| I'm not sure why the route would not work if you can see it in the routing table. I would definitely check the ownership and permissions on everything. Your mileage may vary but I have... Code: Roark-Holzs-iMac:/Library root# cd /Library
Roark-Holzs-iMac:/Library root# ls -l
--- Stuff Removed ---
0 drwxr-xr-x 6 root wheel 204 Apr 6 13:22 StartupItems
--- Stuff Removed ---
Roark-Holzs-iMac:/Library root# cd StartupItems
Roark-Holzs-iMac:/Library/StartupItems root# ls -l
drwxr-xr-x 4 root wheel 136 Apr 6 12:50 AddRoutes
Roark-Holzs-iMac:/Library/StartupItems root# cd AddRoutes
Roark-Holzs-iMac:/Library/StartupItems/AddRoutes root# ls -l
-rwxr-xr-x 1 root wheel 292 Apr 6 10:05 AddRoutes
-rwxr-xr-x 1 root wheel 127 Apr 6 09:47 StartupParameters.plist
File contents...
Roark-Holzs-iMac:/Library/StartupItems/AddRoutes root# cat AddRoutes
#!/bin/sh
# Set up static routing tables
# Roark Holz, Thursday, April 6, 2006
. /etc/rc.common
StartService ()
{
ConsoleMessage "Adding Static Routing Tables"
route add -net 192.168.3.0/24 192.168.0.180
}
StopService ()
{
return 0
}
RestartService ()
{
return 0
}
RunService "$1"
Roark-Holzs-iMac:/Library/StartupItems/AddRoutes root# cat StartupParameters.plist
{
Description = "Add static routing tables";
Provides = ("AddRoutes");
Requires = ("Network");
OrderPreference = "None";
} Roark |
|
#6
| |||
| |||
| Yes everything is equal to that.... I solved it just adding sudo in front of route add and now it works .... Someone suggested me an alternate method : use login item , but don't have a clue of how to do them.. do you have some hints about them ? |
|
#7
| |||
| |||
| Hi Roarkh, I need help about the route. I make in /Library/Startupitems/Addroutes the two files Addroutes and StartupParameters.plist with the same data like the exemple. But when i restart my computer never happen, the static route is not there. In my file Addroutes I put: StartService () { Console Message "Adding Static Routing Tables" route add -n 192.168.0.0 192.168.0.10 255.255.0.0 } with the others parameters, to add my route. I make the new folder Addroutes in /Library/System/Startupitems, and i see in /System/Library/Startupitems that i haved a folder with the name StaticRoutes with a similiar script. So my question is: Where i put Addroutes? I need remove the folder StaticRoutes in System/Library/Startupitems? TXS |
|
#8
| |||
| |||
| Hi Sorry to revive old threads, but I have tried all the suggestions here and on the other linked threads, and I cannot get any persistent routes at all. Has anyone any tips for making this work?? The routes I am adding do not show up in netstat -r after a reboot. The line I am using in the StartupItems subfolder is Code: sudo route -nv add -host 191.253.0.0 -netmask 255.255.0.0 -interface 192.157.10.241 Thanks Andy
__________________ Macbook, 2.0GHz, 2Gb, 160Gb. 10.5 Mac Mini, 1.42GHz G4, 512Mb, 80Gb. 10.4 1G iPod Touch 8Gb 1G iPod Nano 2Gb white 1G iPod Shuffle 512Mb |
![]() |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Static route | bizantl | Networking & Compatibility | 0 | December 11th, 2005 01:27 PM |
| permanent share | jcombs_31 | Networking & Compatibility | 0 | November 18th, 2005 02:23 PM |
| adding permanent static routes? | vanyel | Networking & Compatibility | 1 | July 22nd, 2005 08:01 PM |
| Help me fix my lan. I think I need a static route? | Fahrvergnuugen | Unix & X11 | 5 | September 1st, 2002 11:03 AM |
| Adding static route | lenoil | Mac OS X System & Mac Software | 5 | March 6th, 2002 10:56 PM |