Re: Newbie routing question

2006-09-22 Thread Stuart Henderson
On 2006/09/22 10:04, Lars Hansson wrote:
> On Thursday 21 September 2006 20:24, Stuart Henderson wrote:
> > -static is the default for routes added by route(8), netstat -rn
> > indicates this as S in the flags column.
> 
> Hmm, really?

Looks like it, for a manually added route (commonly named
"adding a _static_ route").

> I recall having to use the -static option to make the routes 
> stick. Maybe this was made the default recently or maybe the -static option 
> does something more than mark the route as S?

-static just sets the RTF_STATIC flag, but in src/sbin/route/route.c,
newroute() sets RTF_STATIC anyway (and has done since 1994) unless you
deliberately use -nostatic, so -static is a noop when you add a static
route. If you adjust a route added by some other method, you might
need it though.

newroute(int argc, char **argv)
{
char *cmd, *dest = "", *gateway = "", *error;
int ishost = 0, ret = 0, attempts, oerrno, flags = RTF_STATIC;


Re: Newbie routing question

2006-09-21 Thread Lars Hansson
On Thursday 21 September 2006 20:24, Stuart Henderson wrote:
> -static is the default for routes added by route(8), netstat -rn
> indicates this as S in the flags column.

Hmm, really? I recall having to use the -static option to make the routes 
stick. Maybe this was made the default recently or maybe the -static option 
does something more than mark the route as S?


Lars Hansson


Re: Newbie routing question

2006-09-21 Thread Stuart Henderson
On 2006/09/21 11:18, Lars Hansson wrote:
> On Wednesday 20 September 2006 22:32, Stuart Henderson wrote:
> > You can add !route add 10.82/15 172.18.254.1 to the relevant
> > /etc/hostname.if file, and the route will be added when the network
> > interface comes up.
> 
> You might want to use the -static flag with that, otherwise the route will 
> dissapear forever (or at least until you reboot) if, for example, you lose 
> carrier on the interface.

-static is the default for routes added by route(8), netstat -rn
indicates this as S in the flags column.


Re: Newbie routing question

2006-09-21 Thread Lars Hansson
On Wednesday 20 September 2006 22:32, Stuart Henderson wrote:
> You can add !route add 10.82/15 172.18.254.1 to the relevant
> /etc/hostname.if file, and the route will be added when the network
> interface comes up.

You might want to use the -static flag with that, otherwise the route will 
dissapear forever (or at least until you reboot) if, for example, you lose 
carrier on the interface.

---
Lars Hansson


OT: Re: Newbie routing question

2006-09-20 Thread Karl O. Pinc

(This is really offtopic for the pf list.  You want the
openBSD misc list.)

On 09/20/2006 08:14:56 AM, charles Collin wrote:

1 for a my client's private network reachable via a Cisco router  
linked to a T1.


The IP address of the LAN interface on the Cisco router is  
172.18.254.1 and i cannot change it (i don't own it, it is my  
client's).



I set up /etc/mygate with the default gateway I.N.E.T1.
Now i would like machines on my LAN to be routed towards 172.18.254.1.


Seems to me your default gateway should be 172.18.254.1
because that's what your OpenBSD box is plugged in to.


Karl <[EMAIL PROTECTED]>
Free Software:  "You don't pay back, you pay forward."
 -- Robert A. Heinlein


Re: Newbie routing question

2006-09-20 Thread Brian
Charles,
You can actually insert the route command in your hostname.if
(replace 'if' with the interface you are using).  you would insert the
following line at the end of the file to add the router after the
interface comes up.  There may be a better way to do this, but this will
work.

!/sbin/route add 10.82/15 172.18.254.1




charles Collin wrote:
> Hi,
>
> I'm really new to OpenBSD.
> I recently installed version 3.9 and am trying to set it up as a
> router/NAT.
>
> I have 4 interfaces on this box:
> 1 for man LAN
> 1 for my DMZ
> 1 for a my client's private network reachable via a Cisco router
> linked to a T1.
> 1 for Inet (i got 8 public addresses, among which one for my box
> interface and another for a Cisco router connected to internet via
> ADSL, let's say my IP is I.N.E.T2 and the router's is I.N.E.T1)
>
> The IP address of the LAN interface on the Cisco router is
> 172.18.254.1 and i cannot change it (i don't own it, it is my client's).
> The private network's address is 10.82/15
>
> I set up /etc/mygate with the default gateway I.N.E.T1.
> Now i would like machines on my LAN to be routed towards 172.18.254.1.
> I can do that with a:
>
> route add 10.82/15 172.18.254.1
>
> The only problem is when i reboot the OpenBSD box, this route disappears!
>
> I can't figure out how to make new routes persistent, though i've been
> googleing quite a lot.
>
> Is there any file in /etc that gets read by the system at boot time
> that configures additional routes like /etc/mygateway ?
>
> Thx a lot
>
> Cheers


Re: Newbie routing question

2006-09-20 Thread Stuart Henderson
On 2006/09/20 15:14, charles Collin wrote:
> I can do that with a:
>   route add 10.82/15 172.18.254.1
> The only problem is when i reboot the OpenBSD box, this route disappears!
>
> I can't figure out how to make new routes persistent, though i've been 
> googleing quite a lot.
> 
> Is there any file in /etc that gets read by the system at boot time that 
> configures additional routes like /etc/mygateway ?

You can add !route add 10.82/15 172.18.254.1 to the relevant
/etc/hostname.if file, and the route will be added when the network
interface comes up.