# ifconfig does not save



## Tosti (Apr 5, 2013)

Hi, I do have a problem, when I am trying to configure ifconfig. [cmd=]ifconfig inet ip netmask netmask[/cmd]. After this, it works. If I do reboot my server, all those configurations reset (sorry, I don't know how to explain this), and my server is not connected anymore to the internet. Can you give me some advice?

Thanks.


----------



## SirDice (Apr 5, 2013)

Why would you think those settings are saved?

You need to edit /etc/rc.conf:

```
ifconfig_rl0="inet 1.2.3.4 netmask 255.255.255.0"
```
That's assuming the interface is rl(4).


----------



## lbol (Apr 5, 2013)

Put your configuration into /etc/rc.conf to make it permanent


----------



## Tosti (Apr 5, 2013)

Sorry if I am wrong. I am new in FreeBSD. My interface is vr0.


----------



## SirDice (Apr 5, 2013)

Tosti said:
			
		

> My interface is vr0.


Then it'll be something like:

```
ifconfig_vr0="inet 1.2.3.4 netmask 255.255.255.0"
```


----------



## Tosti (Apr 5, 2013)

I do have one last question (and yes, it did work, thanks for helping, @SirDice), where should I put the gateway?


----------



## wblock@ (Apr 5, 2013)

In both ifconfig(8) and rc.conf, CIDR notation can be used instead of a separate netmask.  192.168.1.150/24, for example.


----------



## Tosti (Apr 5, 2013)

I did the command [CMD=""]ifconfig vr0 inet 192.168.1.10 netmask 255.255.255.0[/CMD], and here is what I got:

```
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=82808<VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
        ether 00:0a:e6:69:44:d8
        inet6 fe80::20a:e6ff:fe69:44d8%vr0 prefixlen 64 scopeid 0x5
        inet 192.168.1.10 netmask 0xffffff00 broadcast 192.168.1.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
```

If I use [CMD=]ping http://www.google.com[/CMD], this error shows up:

```
[root@privat /]# ping www.google.com
ping: cannot resolve www.google.com: Host name lookup failure
```

Any help please?


----------



## Savagedlight (Apr 5, 2013)

/etc/rc.conf: 

```
defaultrouter="192.168.1.1"
```
/etc/resolv.conf:

```
nameserver a.b.c.d
nameserver e.f.g.h
```
You can add as many nameservers as you'd like. These need to be IP addresses.


----------



## Tosti (Apr 5, 2013)

I know those must be IP addresses

```
Generated by resolvconf
nameserver 193.231.100.130
nameserver 193.231.100.134
```
I did what you've said, 
	
	



```
defaultrouter="192.168.1.1"
```
 I rebooted my PC and now [cmd=]ping http://www.google.com[/cmd] works.But I still have a weird netmask and broadcast did change after reboot.Before it was 192.168.1.225, now it is 222.190.1.225

```
vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=82808<VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
        ether 00:0a:e6:69:44:d8
        inet 192.168.1.10 netmask 0xe1e1ff00 broadcast 222.190.1.255
        inet6 fe80::20a:e6ff:fe69:44d8%vr0 prefixlen 64 scopeid 0x5
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
```
Is that normal?


----------



## kpa (Apr 5, 2013)

How did you write the address in rc.conf? We can't offer help if you don't provide all the necessary information.


----------



## Tosti (Apr 5, 2013)

Here's rc.conf

```
hostname="privat"
ifconfig_vr0="YES"
sshd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
mysql_enable="YES"
ifconfig_vr0="inet 192.168.1.10 netmask 225.225.255.0"
defaultrouter="192.168.1.1"
```


----------



## wblock@ (Apr 5, 2013)

Tosti said:
			
		

> ```
> ifconfig_vr0="YES"
> ```



YES is not a valid value for an ifconfig setting.  But this line will be ignored because it is overwritten by a value later in the file.  Remove it.



> ```
> ifconfig_vr0="inet 192.168.1.10 netmask [color="Red"]225[/color].[color="Red"]225[/color].255.0"
> ```



Those are likely typos and should be 255, not 225.  Or just change to a simpler form:

```
ifconfig_vr0="inet 192.168.1.10/24"
```


----------



## _martin (Apr 6, 2013)

Check out this FreeBSD handbook, you can find a lot of information about configuration, etc. 

Your case can be found in this chapter.


----------



## Tosti (Apr 6, 2013)

Thanks for your great answ*e*rs.I typed wrong (225 instead of 255), and it now works.


----------

