# Static IP Address



## hansonian (Apr 28, 2010)

After much use of the search function I've come up with nothing so now I have to ask. I've got a clean install of FreeBSD 8.0 and I'm trying to figure out how to set it for a static IP address. When I did the initial install I let it sort out the DHCP settings and once it was past that I realized I should have set it then. What's the best way to go about doing this now?

Thanks in advanced.


----------



## graudeejs (Apr 28, 2010)

as I understand you want to use DHCP?
in your /etc/rc.conf

```
ifconfig_[B]re0[/B]="DHCP"
```
replace re0 with your interface


----------



## hansonian (Apr 28, 2010)

Nope, already have DHCP set would like to make it static IP and manually configure everything.


----------



## anomie (Apr 28, 2010)

Good news is this is documented in rc.conf(5). And there are a couple examples you can review in /etc/defaults/rc.conf.


----------



## FBSDin20Steps (Apr 28, 2010)

Since this is a virgin install you might want to use sysinstall again...


----------



## graudeejs (Apr 28, 2010)

FBSDin20Steps said:
			
		

> Since this is a virgin install you might want to use sysinstall again...



Don't listen to ^^^
better do it manually :d


----------



## FBSDin20Steps (Apr 28, 2010)

killasmurf86 said:
			
		

> Don't listen to ^^^
> better do it manually :d



What's your problem killasmurf86?


----------



## SirDice (Apr 28, 2010)

Just edit /etc/rc.conf and change the ifconfig line to something like:

```
ifconfig_rl0="192.168.5.12 netmask 255.255.255.0"
```

Really no need for sysinstall


----------



## phoenix (Apr 28, 2010)

Once the OS is installed and you have booted into it, then you should forget that sysinstall even exists.  Don't use sysinstall to configure the system.   Use it to install the system, and then forget about it.

You'll save yourself a hell of a lot of headaches down the line.  And, you'll actually learn how to configure the system properly.


----------



## FBSDin20Steps (Apr 28, 2010)

This is optional. Since he is new to FreeBSD the easiest way is to run sysinstall or read the handbook for that matter.


----------



## anomie (Apr 28, 2010)

OP is a two-post wonder (so far), and may be long gone already. All of these solutions work fine...


----------



## phoenix (Apr 28, 2010)

FBSDin20Steps said:
			
		

> This is optional. Since he is new to FreeBSD the easiest way is to run sysinstall or read the handbook for that matter.



If you see a man starving on the street, do you toss a fish at his feet to allow him to eat right now, and be hungry again tomorrow (sysinstall)?

Or do you teach him how to fish and catch all the fish he can eat whenever he's hungry (man pages, handbook, rc.conf, etc)?



Just because sysinstall provides a simplistic method to configure some things doesn't mean you should use it.  Especially since it fills up rc.conf with redundant entries that can overlap.

Do things the right way, from the beginning, and save everyone a lot of time and frustration.    Teach people good habits ... otherwise you waste half your time untraining all their bad habits.


----------



## FBSDin20Steps (Apr 28, 2010)

phoenix said:
			
		

> If you see a man starving on the street, do you toss a fish at his feet to allow him to eat right now, and be hungry again tomorrow (sysinstall)?
> 
> Or do you teach him how to fish and catch all the fish he can eat whenever he's hungry (man pages, handbook, rc.conf, etc)?



Your correct on this one.



			
				phoenix said:
			
		

> Just because sysinstall provides a simplistic method to configure some things doesn't mean you should use it.  Especially since it fills up rc.conf with redundant entries that can overlap.



Good suggestions were given. Let the OP himself decide what he wants to do with those reduntant entries.


----------



## hansonian (Apr 29, 2010)

I had actually thought about using sysinstall to reconfigure this but was worried I might jack something else up. I appreciate all the options you guys have given and I'm sure I'll have it set the way I want it here shortly. Thanks to everyone for their suggestions.

I'm hoping not to be a 2 post wonder and maybe one day contribute something of use to someone else.


----------



## hansonian (Apr 29, 2010)

Ok. I've added 
	
	



```
ifconfig_vr0="192.168.4.9 netmask 255.255.255.0
```
 to my rc.conf file. I can now ping other machines on my network and I can ping the FreeBSD machine. If I set my browser to use our proxy server I can get on the internet with no problem but without the proxy settings it won't find it's own way to the internet. I need this to not run through our proxy so this won't work for me. Any ideas on what I've missed?


----------



## graudeejs (Apr 29, 2010)

draw your lan configuration


----------



## hansonian (Apr 29, 2010)

killasmurf86 said:
			
		

> draw your lan configuration



My LAN is pretty simple.

T1----> Router----> Switch----> User Machines / Proxy Server

I have a Ubuntu box setup running Dansguardian/TinyProxy/Firehol to do my URL filtering. I've set the User Machines web browsers to use the Ubuntu machine as the proxy server. At the moment I have the FreeBSD machine running through the proxy but I've put it's IP on the exception list so it has free reign. I'm thinking I'm missing something easy. Even before the FreeBSD machine was set to proxy I could ping other machines but just couldn't see the internet with it.


----------



## DutchDaemon (Apr 29, 2010)

Proxies usually don't have IP-forwarding turned on, simply because the proxy does all the work. Without IP-forwarding, no direct connection to the Internet will be possible.


----------



## hansonian (Apr 29, 2010)

I only set the FreeBSD machine to the proxy so I could check to see if it would get to the internet, which it did. The proxy is setup to filter URLs and such so people don't waste the bandwidth. 

Ideally I would like this machine to work alone on the network. My initial problem was setting a static IP, that's been solved, now the problem is configuring this machine to get to the internet by itself without the proxy which I can't seem to figure out. 

Ultimately this machine is going to run IT Ticket Request software so I'd rather it just sits on the LAN by itself.


----------



## anomie (Apr 29, 2010)

hansonian said:
			
		

> I'm hoping not to be a 2 post wonder and maybe one day contribute something of use to someone else.



Nothing personal.  I just didn't want to see the thread degenerate into a flamewar among members if we were dealing with another drive-by poster.


----------



## hansonian (Apr 29, 2010)

anomie said:
			
		

> Nothing personal.  I just didn't want to see the thread degenerate into a flamewar among members if we were dealing with another drive-by poster.



Roger that.


----------



## phoenix (Apr 29, 2010)

hansonian said:
			
		

> My LAN is pretty simple.
> 
> T1----> Router----> Switch----> User Machines / Proxy Server
> 
> I have a Ubuntu box setup running Dansguardian/TinyProxy/Firehol to do my URL filtering. I've set the User Machines web browsers to use the Ubuntu machine as the proxy server. At the moment I have the FreeBSD machine running through the proxy but I've put it's IP on the exception list so it has free reign. I'm thinking I'm missing something easy. Even before the FreeBSD machine was set to proxy I could ping other machines but just couldn't see the internet with it.



When configuring the IP manually, you also have to configure the DNS resolv.conf and set the default gateway.

You need a *defaultrouter="some IP"* entry in /etc/rc.conf.  Set this to the IP of your router.

You will also need to edit /etc/resolv.conf to set the IP of your DNS servers.  The syntax is:

```
nameserver 1.2.3.4
nameserver 2.3.4.5
```

All of the above are handled automatically by DHCP, which is why you have to set them manually if you don't use DHCP.


----------



## hansonian (Apr 29, 2010)

I had the nameservers set in the resolv.conf file but I didn't even think to put the defaultrouter setting in. It works perfect now. Thanks to everyone for their help. Now I can get on to other problems.


----------

