# Bad Subnet Mask



## MacGeek (Feb 7, 2021)

Good day,

I have an issue in FreeBSD 12.2-Release r366954, saying my subnet mask is bad. 

```
ifconfig_em0="inet 10.16.30.30 netmask=255.255.255.0
default_router="10.16.30.1"
```
Everything works with DHCP, and I have reserved 10.16.30.30/24 in DHCP server. Can some explain what is happen when I change the setting to static. 

Thank you in advance.


----------



## im (Feb 7, 2021)

Hello!


MacGeek said:


> ifconfig_em0="inet 10.16.30.30 netmask=255.255.255.0


Equation mark '=' don't needed at this point.
Try to rewrite the line as `ifconfig_em0="inet 10.16.30.30 netmask 255.255.255.0"`


----------



## Geezer (Feb 7, 2021)

MacGeek said:


> default_router="10.16.30.1"
> and I have reserved 10.16.30.30/24 in DHCP server


Have you then reserved a DHCP range that includes your default router?


----------



## Snurg (Feb 7, 2021)

Forgetting the closing apostroph " sometimes can get real funny error messages


----------



## MacGeek (Feb 10, 2021)

Geezer said:


> Have you then reserved a DHCP range that includes your default router?


Yes,  and the from DHCP it works perfectly. 

```
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8009b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LINKSTATE>
    ether 00:10:18:94:e3:ec
    inet 192.168.30.30 netmask 0xffffff00 broadcast 192.168.30.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=81249b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,LRO,WOL_MAGIC,VLAN_HWFILTER>
    ether 94:57:a5:ee:01:76
    inet 10.16.30.30 netmask 0xffffff00 broadcast 10.16.30.255
    media: Ethernet autoselect (1000baseT <full-duplex>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

Routing tables

Internet:
Destination        Gateway            Flags     Netif Expire
default            10.16.30.1         UGS         em0
10.16.30.0/24      link#2             U           em0
10.16.30.30        link#2             UHS         lo0
127.0.0.1          link#3             UH          lo0
192.168.30.0/24    link#1             U          bge0
192.168.30.30      link#1             UHS         lo0
```


Thank you in advance for your help


----------



## MacGeek (Feb 10, 2021)

im said:


> Hello!
> 
> Equation mark '=' don't needed at this point.
> Try to rewrite the line as "ifconfig_em0="inet 10.16.30.30 netmask 255.255.255.0"


Thank you I will give that a try.


----------



## MacGeek (Feb 10, 2021)

Thank You everyone, removing the equal sign from in front of 255.255.255.0 fixed the issue.

I am new to FreeBSD and still learning all the nuances. Your help was greatly appreciated.


----------



## im (Feb 10, 2021)

You are wellcome!


----------

