Koozali.org: home of the SME Server

static routing

Tony

static routing
« on: February 20, 2002, 08:34:56 AM »
Hi!
I need some help to make static routing in the SME server.
I have some public adresses witch I want to tranfer to some of the pc on the privat net.
How can I do this?
/Tony

Rick

Re: static routing
« Reply #1 on: February 20, 2002, 01:29:22 PM »

Tony

Re: static routing
« Reply #2 on: February 20, 2002, 07:06:25 PM »
Thanks!

But I need to transfer all traffic ( ports ) from one public to one privat adress.
And not only one or some ports..
I need someone who knows static ip route...
/Tony

Hsing-Foo

Re: static routing
« Reply #3 on: February 21, 2002, 03:37:31 PM »
Hi,

You have to make a custom template. Maybe tis helps:

you're must be root on the console.

1. make the custom template dir:

mkdir -p /etc/e-smith/templates-custom/etc/sysconfig/static-routes

2. copy dir and contents of the static routes template to custom template

cp /etc/e-smith/templates/etc/sysconfig/static-routes /etc/e-smith/templates-custom/etc/sysconfig/static-routes

3. edit the custom template fragment 10localroutes and append your static route toe te end of it like:
------------------------------
{
    use esmith::db;

    local %networks;
    tie %networks, 'esmith::config', '/home/e-smith/networks';

    my ($localNetwork, $localBroadcast) =
        esmith::util::computeNetworkAndBroadcast ($LocalIP,
                $LocalNetmask);

    my @routeableNetworks =
            grep { db_get_type(\%networks, $_) eq 'network'
                   && db_get_prop(\%networks, $_, 'Router') ne 'default' }
                    keys %networks;

    foreach my $network ( @routeableNetworks )
    {
        my $networkRouter = db_get_prop(\%networks, $network, 'Router');
        my $networkMask   = db_get_prop(\%networks, $network, 'Mask');
        $device = /sbin/route -n | /bin/grep $localNetwork;
        $device =~ /(eth[0-9]+)/;
        $device = $1;
        $OUT .= "$device net $network netmask $networkMask gateway $networkRouter\n";
    }
}

/sbin/route add 192.168.2.0 gw 192.168.1.1  <--- your new static route
--------------------------------------------------------------

4. Save the file and expand the template:

/sbin/e-smith/expand-template /etc/sysconfig/static-routes

5. restart the network:

/etc/rc.d/init.d/network restart

That's it.

Regards,
RequestedDeletion