Advertisement

Setting a gateway in BSD without DHCP

Started by June 12, 2003 01:06 PM
4 comments, last by Monder 21 years, 4 months ago
Right I''m trying to set up a webserver on a BSD box but I''m having a problem. I''ve given my server a static i.p on my local network so I can then set my ADSL router to forward port 80 to it and it''s i.p. won''t ever change (Cause otherwise the DHCP lease thing will expire and the i.p. will change and I don''t think I can switch this off). I set up the IP of the box statically fine but But I have no idea of how to set up the box so the router is the default gateway. How can I do this?
I''m not entirely sure if I understand what you are asking, so let me try to clear this up. You have a hardware router, right? And you want to use your BSD box as a webserver?
Advertisement
Yeah I have a hardware router. I have a BSD Box which I want to be a webserver but I have to tell it to use that router as an internet gateway. I was using DHCP for it but now I''ve set it up to a static IP so the router can forward port 80 to that specific address the default gateway is getting set up automatically so I need a way to specify it.
In your /etc/rc.conf


add a line

defaultrouter="ip address"

Probably 192.168.0.1 or 192.168.1.1 if you're behind a NAT.

defaultrouter="192.168.1.1"


You can check your results by doing " netstat -rn". The first line returned should be your default.

Interim

[edited by - Interim on June 12, 2003 5:57:15 PM]
Thanks a lot. It''s working now.
No problem.

You can set most of the system type stuff in /etc/rc.conf. Kinda of a one shop stop.

Also look into sysctl. It''s like modifying the /proc system in Linux, but sysctl + grep is nicer than scanning proc.

Interim

This topic is closed to new replies.

Advertisement