Koozali.org: home of the SME Server

Custom Routing

Offline Brave Dave

  • *
  • 185
  • +0/-0
Custom Routing
« on: October 27, 2008, 03:06:29 AM »
I have some custom routing requirements on my external interface - two gateways - one to the internet, one to another network

(sme in server/gateway mode)

I have created a script to do this
- where in the templates-custom tree would I place this to ensure it survives a reboot ?
.:DB:.

Offline gzartman

  • *
  • 306
  • +0/-0
    • LEI Engineering & Surveying
Re: Custom Routing
« Reply #1 on: October 27, 2008, 03:23:50 AM »
I have some custom routing requirements on my external interface - two gateways - one to the internet, one to another network

(sme in server/gateway mode)

I have created a script to do this
- where in the templates-custom tree would I place this to ensure it survives a reboot ?

Please post your custom routing requirement here, using 'x's or something in place of any IP information that may be a security issue for you.  This will increase your chances of getting an answer that will solve your issue.

Speaking in very general terms, any template fragment placed in /etc/e-smith/templates-custom/ will survive a reboot.  Just keep in mind that template expansion doesn't automatically happen when you reboot your SME box.  You'll either need to manually expand the templates using the /sbin/e-smith/expand-template utility or expand the templates as part of an SME event.

Greg
« Last Edit: October 27, 2008, 03:26:08 AM by gzartman »
----
Greg J. Zartman
LEI Engineering & Surveying

SME user and community member since 2000.

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Custom Routing
« Reply #2 on: October 27, 2008, 03:32:39 AM »
my internal network is : 192.168.1.0/24
external interface : 172.10.16.66
my default gateway : 172.10.16.69


I have another network which I can access through 172.18.17.65 so I issue

route add -net 192.168.20.0 netmask 255.255.255.0 gw 172.18.17.65

The file I would like to affect is;
 /etc/sysconfig/network-scripts/route-eth1

eth1 is my external interface

but I can't figure out how to do this within the templating system
« Last Edit: October 27, 2008, 06:06:57 AM by davidbray »
.:DB:.

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Re: Custom Routing
« Reply #3 on: October 27, 2008, 07:11:57 AM »
A start might be to duplicate

/etc/e-smith/templates/etc/sysconfig/network-scripts/route-ethX


under the templates-custom path.

/etc/e-smith/templates-custom/etc/sysconfig/network-scripts/route-ethX

Then add some new properties to the networks db.

db networks show

Plus some perl scripting.
« Last Edit: October 27, 2008, 07:16:00 AM by william_syd »
Regards,
William

IF I give advise.. It's only if it was me....

Offline mercyh

  • *
  • 824
  • +0/-0
    • http://mercyh.org
Re: Custom Routing
« Reply #4 on: October 27, 2008, 02:56:33 PM »
davidbray,

If I understand what you are doing. I think you should be able to do it from the Local Networks menu under Security in Server-Manager without any custom work.

See: http://wiki.contribs.org/SME_Server:Documentation:Administration_Manual:Chapter11#Local_networks


Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Custom Routing
« Reply #5 on: October 27, 2008, 10:16:06 PM »
Hi, Thanks for the replies

No you can't add external networks, they have to have a router on the local network

I have succeeded in following william_syd advice and modifying scripts around
 /etc/sysconfig/network-scripts/route-ethX

and this is successfull, I kind of knew this, but this area is not as straight forward as say /etc/rc.d/init.d/masq;

.:DB:.

Offline mercyh

  • *
  • 824
  • +0/-0
    • http://mercyh.org
Re: Custom Routing
« Reply #6 on: October 27, 2008, 10:25:52 PM »
Yes, I see what you are doing now. I have always had another router in front of SME. Then it is just a matter of adding the other subnets to local networks.

In this case SME IS the router.

I didn't read this:
Quote
(sme in server/gateway mode)
thoroughly enough.  :(

Offline CharlieBrady

  • *
  • 6,918
  • +3/-0
Re: Custom Routing
« Reply #7 on: October 27, 2008, 10:29:19 PM »
No you can't add external networks, they have to have a router on the local network

You could add the networks db entry via the command line.

You could also solve this problem just in the masq script templates. If you allow icmp redirect packets in from your default router, and the default router knows the route to your additional route, then SME server will learn the correct route quickly enough.

Offline Brave Dave

  • *
  • 185
  • +0/-0
Re: Custom Routing
« Reply #8 on: October 27, 2008, 10:31:51 PM »
Now that's a little gem

that old saying
look outside the (sme) box ...

thanks Charlie
.:DB:.