# Default gateway on FreeBSD 1.1



## Zerker (Oct 15, 2017)

So yes, I installed FreeBSD 1.1 for fun and learning on a Unisys CWD4002 small-form factor 486. It has a humble 350 MB hard drive, 16 MB of RAM, with a 1.44 MB floppy drive and no CD-ROM. The RAM and the floppy-install necessitated a rather old version of BSD, so I decided to go all the way back to the first major revision in order to get the smallest install size. It does, however, have a built-in 10Base-T network interface, which is what I'm tinkering with now.

The only stubling block is the default gateway configuration (as DHCP is not an option yet). I've been able to add the gateway manually:
`# route add default 10.0.1.1`
Which results in the following routing table:

```
$ netstat -rn
Routing tables
Destination      Gateway            Flags     Refs     Use  IfaceMTU    Rtt   
Netmasks:
(root node)
(0) 0000 ff00                               
(root node)

Route Tree for Protocol Family inet:
(root node) =>
default          10.0.1.1           UG          0        0  ed0 -      -     
10               10.0.1.10          U           2      103  ed0 -      -     
127.0.0.1        127.0.0.1          UH          1        0  lo0 -      -     
(root node)
```
But getting it to persist has been a bit awkward. Part of the problem is that I'm not finding any good examples of /etc/gateways online. The best I found was for Solaris.

But when I set my gateways file as follows:

```
$ cat /etc/gateways
net 0.0.0.0 gateway 10.0.1.1 metric 100 passive
```
I just get a garbage entry in the routing table:

```
$ netstat -rn
Routing tables
Destination      Gateway            Flags     Refs     Use  IfaceMTU    Rtt   
Netmasks:
(root node)
(0) 0000 ff00                               
(root node)

Route Tree for Protocol Family inet:
(root node) =>
default          (0)                UG          0        0  ed0 -      -     
10               10.0.1.10          U           3      379  ed0 -      -     
127.0.0.1        127.0.0.1          UH          1        0  lo0 -      -     
(root node)
```
And I'm not really sure what I'm doing wrong. The manpage for this version of BSD (attached) indicates that the format is correct, but again it has no examples.

Yes, I can just put the route() command in a startup script instead, but that feels like cheating somehow. I'd really just like to get the correct format so the gateways file is happy.


----------



## Zerker (Oct 15, 2017)

Maybe so, but that doesn't work in 1.1 (judging by your edit, you found that out too). 1.1 only has startup shell scripts rc and rc.local, no rc.conf file. I've placed the route line at the end of rc.local, which works for now, but I'd still like to figure out the gateways file. Considering that this is the entire purpose of that file, after all...

Edit in response to your edit: rc does indeed invoke routed() (and my version essentially matches your link), but per the documentation, routed() is the one that is supposed to be setting up the routes. And, lo and behold, routed() uses /etc/gateways.

I looked briefly into the option of gated, but that's apparently for other deployments or something; it's not included by default.


----------



## ronaldlees (Oct 28, 2017)

Interesting post.  I played with an older FreeBSD (2.x IIRC) - some time ago, and while fun it was a little frustrating too.  We get used to and then take for granted all the improvements that have happened since that time.

Here's a suggestion:  NetBSD/i386 needs only 4M RAM, and you could build a hard drive image using that OS and QEMU, and then "dd" that image over to your hard drive, and have a modern OS. You indicated only "BSD" without a prefix, so I took that to be BSD agnostic.  I wish FreeBSD could be configured with a smaller memory footprint, because I have some old junker i386/486 stuff that I could put to some dedicated uses if that were the case.


----------



## Zerker (Oct 28, 2017)

Thanks for the reply. However, after I got everything set up, and had my fun, I decided I didn't need to keep that many computers. I have since sold the 486 to someone else.


----------

