# CIDR Notation in rc.conf



## hederaleaf (Mar 8, 2017)

I have apportioned to me an IP Subnet that is designated as follows:


```
Network:   10.0.0.8/29
Gateway:   10.0.0.9
Broadcast: 10.0.0.15
Netmask:   255.255.255.248
```

I’m having trouble nailing down what the preferred way to express this configuration via rc.conf is.

Currently, I’m just allowing DHCP to dictate the server’s IP address. That is, in rc.conf:


```
ifconfig_dc0="DHCP"
```

resulting in the following output from `ifconfig -a`:


```
dc0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet6 fe80::204:e2ff:fe33:e3ac%dc0 prefixlen 64 scopeid 0x1 
    inet 10.0.0.14 netmask 0xfffffff8 broadcast 10.0.0.15 
    ether 00:a0:cc:da:da:da
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 
    inet 127.0.0.1 netmask 0xff000000
```

My end-goal is to use 10.0.0.11 to address the host and to set up service jails utilizing VNET to provide a virtualized network stack for the remaining addresses (10.0.0.12-14). I’ve read ifconfig(8) and rc.conf(5), particularly the subsection labeled network_interfaces in rc.conf(5), but it’s still unclear to me what the preferred way to express such a configuration. Surely it’s not so simple as setting in rc.conf:


```
ifconfig_dc0="inet 10.0.0.8/29"
```

and walking away. My reticence to just try-and-see is that it requires some additional effort on my part to get console access to this particular server, and so misconfiguring the network interface would be burdensome.

Any help at all would be appreciated!

Thanks,


Jonathan Caprell


----------



## Psylozoff (Mar 9, 2017)

You don't need DHCP, you just have to set ip addresses manually...
10.0.0.8 is your network address, so you just can't put it on any NIC, afaik..!


```
ifconfig_dc0="inet 10.0.0.11 netmask 0xfffffff8"
```
or

```
ifconfig_dc0="inet 10.0.0.11 netmask 255.255.255.248"
```
in /etc/rc.conf should work though, if that particular address hasn't  been set to any other host by DHCP, already...

If you need several addresses for a card and use aliases, remember that netmask has to be fullfilled with 1 for aliases!

```
ifconfig_dc0_alias0="inet 10.0.0.11 netmask 0xffffffff"
```

Then if you use jails, you will probably set ips on jail startup, in /etc/jail.conf

```
yourjailname {
interface="lo12";
ip4.addr="10.0.0.12";
}
```
You would have already cloned up interfaces, typing `service netif cloneup` after putting in /etc/rc.conf

```
cloned_interfaces="lo12 lo13 lo14"
```


----------

