DHCP Server

Hello,

Is there any possibility that DHCP server can listen on specific network interfaces? On my school lessons we were setting up DHCP server in Linux and there you can point to network interface to issue IP addresses and in FreeBSD I tried same way but no success. When I start or restart dhcpd I get following:

Code:
root@ldrive:/usr/local/etc/unbound # service dhcpd restart
/etc/rc.conf: ifconfig_vm-public=inet 10.0.0.100 netmask 255.0.0.0: not found
/etc/rc.conf: ifconfig_vm-public=inet 10.0.0.100 netmask 255.0.0.0: not found
Stopping dhcpd.
Waiting for PIDS: 3623.
Starting dhcpd.
Can't listen on tap3 - dhcpd.conf has no subnet declaration for 10.0.0.40.
Can't listen on tap2 - dhcpd.conf has no subnet declaration for 10.0.0.30.
Can't listen on tap0 - dhcpd.conf has no subnet declaration for 10.0.0.20.
Can't listen on tap1 - dhcpd.conf has no subnet declaration for 10.0.0.10.
Can't listen on vm-public - it has no IP address.
Listening on bge1 (172.16.0.1).
Can't listen on bge0 - dhcpd.conf has no subnet declaration for 192.168.2.11.

My dhcpd.conf is as follows:
Code:
# dhcpd.conf
#INTERFACES="bge1 tap0 tap1 vm-public"

#########################
# Konfiguracja sieci    #
#########################

subnet 172.16.0.0 netmask 255.255.0.0 {
    range 172.16.0.120 172.16.0.200;
    option domain-name-servers 8.8.8.8, 8.8.8.4;
    option routers 172.16.0.1;
    option broadcast-address 172.16.255.255;
    option ip-forwarding on;
    default-lease-time 600;
    max-lease-time 7200;
    }

#########################
# Adresy                #
#########################

host accesspointac               { hardware ethernet 80:E0:1D:AB:C7:F4; fixed-address 172.16.1.2;}
host airost                      { hardware ethernet B4:0E:DE:17:C1:04; fixed-address 172.16.0.3;}
host airostmobile                { hardware ethernet FC:2A:9C:72:38:F2; fixed-address 172.16.0.4;}
host aszka                       { hardware ethernet CC:2F:71:A0:F9:10; fixed-address 172.16.0.5;}
host aszkamobile                 { hardware ethernet E0:89:7E:50:A1:E3; fixed-address 172.16.0.6;}
host aszkaipad                   { hardware ethernet DC:A4:CA:91:F9:A5; fixed-address 172.16.0.7;}
host PS4                         { hardware ethernet 90:CD:B6:EE:EA:81; fixed-address 172.16.0.8;}
host amazontv                    { hardware ethernet 74:C2:46:C3:51:47; fixed-address 172.16.0.9;}
host bluray                      { hardware ethernet 1C:3E:84:BE:48:87; fixed-address 172.16.0.10;}
host nx6330                      { hardware ethernet 00:1C:BF:0A:02:26; fixed-address 172.16.0.11;}
host aszkamobile7plus            { hardware ethernet 6C:AB:31:81:46:19; fixed-address 172.16.0.12;}
host airostiphonese              { hardware ethernet 4C:57:CA:E2:A8:DC; fixed-address 172.16.0.13;}
host airost1070                  { hardware ethernet E4:70:B8:89:C6:A0; fixed-address 172.16.0.14;}

#########################
# Goscie                #
#########################

host romantanskilaptop           { hardware ethernet 70:C9:4E:86:4B:8F; fixed-address 172.16.0.20;}
host vch                         { hardware ethernet 52:6A:A6:3E:88:09; fixed-address 172.16.0.21;}
host wch                         { hardware ethernet 0E:3E:3B:4D:3D:32; fixed-address 172.16.0.22;}
host annatanska                  { hardware ethernet 42:4E:4C:56:D7:E9; fixed-address 172.16.0.23;}
host romantanski                 { hardware ethernet 90:97:F3:D7:AD:36; fixed-address 172.16.0.24;}
host morfinalaptop               { hardware ethernet 60:36:DD:03:12:C7; fixed-address 172.16.0.25;}
host maxcielinski                { hardware ethernet 9A:4E:BB:53:AB:9B; fixed-address 172.16.0.19;}

#########################
# Inne                  #
#########################

host accesspointn                { hardware ethernet F0:F7:55:BB:41:F6; fixed-address 172.16.2.2;}
host accesspointwap561           { hardware ethernet 88:90:8D:3E:23:B0; fixed-address 172.16.0.2;}
host airosteth                   { hardware ethernet 18:31:BF:7B:CC:DE; fixed-address 172.16.0.100;}
host amazontveth                 { hardware ethernet 74:75:48:48:47:04; fixed-address 172.16.0.109;}
host canonprinter                { hardware ethernet DC:CD:2F:4C:9B:D0; fixed-address 172.16.0.110;}
host hpprinter                   { hardware ethernet C8:D3:FF:84:7C:47; fixed-address 172.16.0.111;}
#host ubuntuvm                    { hardware ethernet 58:9C:FC:05:70:B9; fixed-address 10.0.0.2;}
#host win2012servervm             { hardware ethernet 58:9C:FC:09:62:E3; fixed-address 10.0.0.3;}

I wanted to create 2 subnets one to be used on interface bge1 -> 172.16.0.0/16 and the other one to be used for my virtual machines with subnet 10.0.0.0/8 on interfaces tap0, tap1, tap2, tap3 etc.
See below my ifconfig:
Code:
bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
        ether 44:a8:42:47:7f:29
        inet 192.168.2.11 netmask 0xffffff00 broadcast 192.168.2.255
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
bge1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c0099<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE>
        ether 44:a8:42:47:7f:2a
        inet 172.16.0.1 netmask 0xffff0000 broadcast 172.16.255.255
        inet6 fe80::46a8:42ff:fe47:7f2a%bge1 prefixlen 64 scopeid 0x2
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
        nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
bge2: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
        ether 44:a8:42:47:7f:2b
        media: Ethernet autoselect
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
bge3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
        ether 44:a8:42:47:7f:2c
        media: Ethernet autoselect
        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 0x5
        inet 127.0.0.1 netmask 0xff000000
        groups: lo
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
        groups: pflog
pfsync0: flags=0<> metric 0 mtu 1500
        syncpeer: 0.0.0.0 maxupd: 128 defer: off
        syncok: 1
        groups: pfsync
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
        options=80000<LINKSTATE>
        inet 212.159.22.253 --> 195.166.130.255 netmask 0xffffffff
        groups: tun
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
        Opened by PID 491
vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether e6:09:0e:a5:a3:b3
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: tap3 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 14 priority 128 path cost 2000000
        member: tap2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 13 priority 128 path cost 2000000
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 11 priority 128 path cost 2000000
        member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 12 priority 128 path cost 2000000
        member: bge1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 2 priority 128 path cost 20000
        groups: bridge vm-switch viid-4c918@
        nd6 options=9<PERFORMNUD,IFDISABLED>
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet/win2012servervm/0/public
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:20:2e
        inet 10.0.0.10 netmask 0xff000000 broadcast 10.255.255.255
        groups: tap vm-port
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 9290
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet/rockyvm/0/public
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:f9:42
        inet 10.0.0.20 netmask 0xff000000 broadcast 10.255.255.255
        groups: tap vm-port
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 24796
tap2: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet/ubuntuvm/0/public
        options=80000<LINKSTATE>
        ether 58:9c:fc:00:27:08
        inet 10.0.0.30 netmask 0xff000000 broadcast 10.255.255.255
        groups: tap vm-port
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 45718
tap3: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: vmnet/win2022servervm/0/public
        options=80000<LINKSTATE>
        ether 58:9c:fc:10:ff:f6
        inet 10.0.0.40 netmask 0xff000000 broadcast 10.255.255.255
        groups: tap vm-port
        media: Ethernet autoselect
        status: active
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        Opened by PID 50046

And /etc/rc.conf
Code:
hostname="ldrive"
keymap="pl.kbd"
ifconfig_bge0="inet 192.168.2.11 netmask 255.255.255.0"
ifconfig_bge1="inet 172.16.0.1 netmask 255.255.0.0"
#defaultrouter=""
ifconfig_bge1_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
moused_enable="YES"
#ntpdate_enable="YES"
#ntpd_enable="YES"
powerd_enable="YES"
powerd_flags="-a hiadaptive"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
### PPPoE
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="NO"
ppp_profile="plusnet"
### Firewall
pf_enable="YES"
pf_rules="/etc/pfnoaltq.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
### Internet Forwarding
gateway_enable="YES"
### DHCP server
dhcpd_enable="YES"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="bge1"
dhcpd_withumask="022"
dhcpd_withuser="dhcpd"
dhcpd_withgroup="dhcpd"
dhcpd_chroot_enable="YES"
dhcpd_devfs_enable="YES"
### bhyve and virtualization
bhyve_enable="YES"
vm_enable="YES"
vm_dir="zfs:zroot/vms"
vm_list="rockyvm win2012servervm ubuntuvm win2022servervm"
vm_delay="5"
ifconfig_tap0="inet 10.0.0.20 netmask 255.0.0.0"
ifconfig_tap1="inet 10.0.0.10 netmask 255.0.0.0"
ifconfig_tap2="inet 10.0.0.30 netmask 255.0.0.0"
ifconfig_tap3="inet 10.0.0.40 netmask 255.0.0.0"
ifconfig_vm-public="inet 10.0.0.100 netmask 255.0.0.0"
### MiniUPNPd
miniupnpd_enable="YES"
### Unbound
unbound_enable="YES"
local_unbound_enable="NO"
When I also start my Virtual Machines, interfaces and virtual router don't have IP address assigned. I have to manually type:
ifconfig tap3 inet 10.0.0.40 netmask 255.0.0.0

What am I missing?
 
With current rc.conf it should listen only on bge1, and from what I see in console it is trying to listen on all devices unless I got message "Can't listen on XXX it has no subnet declaration XXX.XXX.XXX.XXX" wrong?

Next thing if I change rc.conf line:
dhcpd_ifaces="bge1" to dhcpd_ifaces="bge1 tap0 tap1 tap2 tap3" then:

ifconfig_tap0="inet 10.0.0.20 netmask 255.0.0.0"
ifconfig_tap1="inet 10.0.0.10 netmask 255.0.0.0"
ifconfig_tap2="inet 10.0.0.30 netmask 255.0.0.0"
ifconfig_tap3="inet 10.0.0.40 netmask 255.0.0.0"
to

ifconfig_tap0="DHCP"
ifconfig_tap1="DHCP"
ifconfig_tap2="DHCP"
ifconfig_tap3="DHCP"
and I also add another subnet in dhcpd.conf, how will DHCP server know which subnet to use on what network interface?
 
how will DHCP server know which subnet to use on what network interface?
You only have a pool with subnet 172.16.0.0 netmask 255.255.0.0, so this only applies to the bge1 interface (because it has an IP address in that range). In order to serve a 10.0.0.0/8 pool you will need to have an interface in that range for the DHCP server to bind on. Those tap* interfaces are the interfaces from your VMs. You don't bind your DHCP server to other hosts on your network, so why would you do this with a VM?

You do understand how DHCP works?


The way you've set things up causes both 10.0.0.0/8 and 172.16.0.0/16 networks to be on bge1. It's generally a bad idea to run two different subnets on the same broadcast domain.

What you could do, is to remove igb1 from the vm-public bridge. Then assign 10.0.0.1/8 to vm-public. Configure a 10.0.0.0/8 pool in dhcpd.conf, bind the DHCP server to igb1 (for the 172.16.0.0/16 pool) and vm-public (for the 10.0.0.0/8 pool).
 
Can't listen on bge0 - dhcpd.conf has no subnet declaration for 192.168.2.11.

For every vlan and subnet that you want to provide DHCP you need a separate declaration like:
Code:
subnet 172.16.0.0 netmask 255.255.0.0 {
    range 172.16.0.120 172.16.0.200;
    option domain-name-servers 8.8.8.8, 8.8.8.4;
    option routers 172.16.0.1;
    option broadcast-address 172.16.255.255;
    option ip-forwarding on;
    default-lease-time 600;
    max-lease-time 7200;
    }
assuming your gw is 192.168.2.11 it's not necessary the dhcp server to be the gateway
Code:
subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.200 192.168.2.210;
    option domain-name-servers 8.8.8.8, 8.8.8.4;
    option routers 192.168.2.11;
    option broadcast-address 192.168.2.255;
    option ip-forwarding on;
    default-lease-time 600;
    max-lease-time 7200;
    }
 
I followed SirDice and after system reboot from system startup ifconfig I get:


bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
ether 44:a8:42:47:7f:29
inet 192.168.2.11 netmask 0xffffff00 broadcast 192.168.2.255
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
bge1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
ether 44:a8:42:47:7f:2a
inet 172.16.0.1 netmask 0xffff0000 broadcast 172.16.255.255
inet6 fe80::46a8:42ff:fe47:7f2a%bge1 prefixlen 64 scopeid 0x2
media: Ethernet autoselect (1000baseT <full-duplex,master>)
status: active
nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL>
bge2: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
ether 44:a8:42:47:7f:2b
media: Ethernet autoselect
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
bge3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
ether 44:a8:42:47:7f:2c
media: Ethernet autoselect
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 0x5
inet 127.0.0.1 netmask 0xff000000
groups: lo
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
pfsync0: flags=0<> metric 0 mtu 1500
syncpeer: 0.0.0.0 maxupd: 128 defer: off
syncok: 1
groups: pfsync
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
groups: pflog
tun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1492
options=80000<LINKSTATE>
inet 212.159.22.253 --> 195.166.130.249 netmask 0xffffffff
groups: tun
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
Opened by PID 2539
vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ether 3a:9f:3a:4b:25:66
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap3 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 13 priority 128 path cost 2000000
member: tap2 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 12 priority 128 path cost 2000000
member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 11 priority 128 path cost 2000000
member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
ifmaxaddr 0 port 10 priority 128 path cost 2000000
groups: bridge vm-switch viid-4c918@
nd6 options=9<PERFORMNUD,IFDISABLED>
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: vmnet/rockyvm/0/public
options=80000<LINKSTATE>
ether 58:9c:fc:10:f9:42
groups: tap vm-port
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Opened by PID 3284
tap1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: vmnet/win2012servervm/0/public
options=80000<LINKSTATE>
ether 58:9c:fc:10:20:2e
inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
groups: tap vm-port
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Opened by PID 3519
tap2: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: vmnet/ubuntuvm/0/public
options=80000<LINKSTATE>
ether 58:9c:fc:00:27:08
groups: tap vm-port
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Opened by PID 3699
tap3: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: vmnet/win2022servervm/0/public
options=80000<LINKSTATE>
ether 58:9c:fc:10:ff:f6
groups: tap vm-port
media: Ethernet autoselect
status: active
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Opened by PID 3880

I did have to manually set IP to vm-public

root@ldrive:/home/airost # ifconfig vm-public inet 10.0.0.1 netmask 255.0.0.0

I restarted dhcpd to see output:

root@ldrive:/home/airost # service dhcpd restart
Stopping dhcpd.
Waiting for PIDS: 3242.
Starting dhcpd.
Can't listen on tap3 - it has no IP address.
Can't listen on tap2 - dhcpd.conf has no subnet declaration for 0.0.0.0.
Can't listen on tap1 - it has no IP address.
Can't listen on tap0 - it has no IP address.
Listening on vm-public (10.0.0.1).
Listening on bge1 (172.16.0.1).
Listening on bge0 (192.168.2.11).


Now /etc/rc.conf looks as follows:

hostname="ldrive"
keymap="pl.kbd"
ifconfig_bge0="inet 192.168.2.11 netmask 255.255.255.0"
ifconfig_bge1="inet 172.16.0.1 netmask 255.255.0.0"
ifconfig_vm-public="inet 10.0.0.1 netmask 255.0.0.0"
#defaultrouter=""
ifconfig_bge1_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
moused_enable="YES"
#ntpdate_enable="YES"
#ntpd_enable="YES"
powerd_enable="YES"
powerd_flags="-a hiadaptive"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
### PPPoE
ppp_enable="YES"
ppp_mode="ddial"
ppp_nat="NO"
ppp_profile="plusnet"
### Firewall
pf_enable="YES"
pf_rules="/etc/pfnoaltq.conf"
pf_flags=""
pflog_enable="YES"
pflog_logfile="/var/log/pflog"
### Internet Forwarding
gateway_enable="YES"
### DHCP server
dhcpd_enable="YES"
dhcpd_conf="/usr/local/etc/dhcpd.conf"
dhcpd_ifaces="bge1 vm-public"
dhcpd_withumask="022"
dhcpd_withuser="dhcpd"
dhcpd_withgroup="dhcpd"
dhcpd_chroot_enable="YES"
dhcpd_devfs_enable="YES"
### bhyve and virtualization
bhyve_enable="YES"
vm_enable="YES"
vm_dir="zfs:zroot/vms"
vm_list="rockyvm win2012servervm ubuntuvm win2022servervm"
vm_delay="5"
ifconfig_tap0="DHCP"
ifconfig_tap1="DHCP"
ifconfig_tap2="DHCP"
ifconfig_tap3="DHCP"
### MiniUPNPd
miniupnpd_enable="YES"
### Unbound
unbound_enable="YES"
local_unbound_enable="NO"


and /usr/local/etc/dhcpd.conf:

# dhcpd.conf

#########################
# Konfiguracja sieci #
#########################

subnet 172.16.0.0 netmask 255.255.0.0 {
range 172.16.0.120 172.16.0.200;
option domain-name-servers 172.16.0.1, 8.8.8.8;
option routers 172.16.0.1;
option broadcast-address 172.16.255.255;
option ip-forwarding on;
default-lease-time 600;
max-lease-time 7200;
}

subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.200 192.168.2.210;
option domain-name-servers 8.8.8.8, 8.8.8.4;
option routers 192.168.2.11;
option broadcast-address 192.168.2.255;
option ip-forwarding on;
default-lease-time 600;
max-lease-time 7200;
}

subnet 10.0.0.0 netmask 255.0.0.0 {
range 10.0.0.10 10.0.0.15;
option domain-name-servers 8.8.8.8, 8.8.8.4;
option routers 10.0.0.1;
option broadcast-address 10.0.0.255;
option ip-forwarding on;
default-lease-time 600;
max-lease-time 7200;
}

#########################
# Adresy #
#########################

host accesspointac { hardware ethernet 80:E0:1D:AB:C7:F4; fixed-address 172.16.1.2;}
host airost { hardware ethernet B4:0E:DE:17:C1:04; fixed-address 172.16.0.3;}
host airostmobile { hardware ethernet FC:2A:9C:72:38:F2; fixed-address 172.16.0.4;}
host aszka { hardware ethernet CC:2F:71:A0:F9:10; fixed-address 172.16.0.5;}
host aszkamobile { hardware ethernet E0:89:7E:50:A1:E3; fixed-address 172.16.0.6;}
host aszkaipad { hardware ethernet DC:A4:CA:91:F9:A5; fixed-address 172.16.0.7;}
host PS4 { hardware ethernet 90:CD:B6:EE:EA:81; fixed-address 172.16.0.8;}
host amazontv { hardware ethernet 74:C2:46:C3:51:47; fixed-address 172.16.0.9;}
host bluray { hardware ethernet 1C:3E:84:BE:48:87; fixed-address 172.16.0.10;}
host nx6330 { hardware ethernet 00:1C:BF:0A:02:26; fixed-address 172.16.0.11;}
host aszkamobile7plus { hardware ethernet 6C:AB:31:81:46:19; fixed-address 172.16.0.12;}
host airostiphonese { hardware ethernet 4C:57:CA:E2:A8:DC; fixed-address 172.16.0.13;}
host airost1070 { hardware ethernet E4:70:B8:89:C6:A0; fixed-address 172.16.0.14;}

#########################
# Goscie #
#########################

host romantanskilaptop { hardware ethernet 70:C9:4E:86:4B:8F; fixed-address 172.16.0.20;}
host vch { hardware ethernet 52:6A:A6:3E:88:09; fixed-address 172.16.0.21;}
host wch { hardware ethernet 0E:3E:3B:4D:3D:32; fixed-address 172.16.0.22;}
host annatanska { hardware ethernet 42:4E:4C:56:D7:E9; fixed-address 172.16.0.23;}
host romantanski { hardware ethernet 90:97:F3:D7:AD:36; fixed-address 172.16.0.24;}
host morfinalaptop { hardware ethernet 60:36:DD:03:12:C7; fixed-address 172.16.0.25;}
host maxcielinski { hardware ethernet 9A:4E:BB:53:AB:9B; fixed-address 172.16.0.19;}

#########################
# Inne #
#########################

host accesspointn { hardware ethernet F0:F7:55:BB:41:F6; fixed-address 172.16.2.2;}
host accesspointwap561 { hardware ethernet 88:90:8D:3E:23:B0; fixed-address 172.16.0.2;}
host airosteth { hardware ethernet 18:31:BF:7B:CC:DE; fixed-address 172.16.0.100;}
host amazontveth { hardware ethernet 74:75:48:48:47:04; fixed-address 172.16.0.109;}
host canonprinter { hardware ethernet DC:CD:2F:4C:9B:D0; fixed-address 172.16.0.110;}
host hpprinter { hardware ethernet C8:D3:FF:84:7C:47; fixed-address 172.16.0.111;}
host tap0rockyvm { hardware ethernet 58:9C:FC:10:F9:42; fixed-address 10.0.0.20;}
host tap1win2012servervm { hardware ethernet 58:9C:FC:10:20:2E; fixed-address 10.0.0.30;}
host tap2ubuntuvm { hardware ethernet 58:9C:FC:00:27:08; fixed-address 10.0.0.40;}
host tap3win2022servervm { hardware ethernet 58:9C:FC:10:FF:F6; fixed-address 10.0.0.50;}
#host ubuntuvm { hardware ethernet 58:9C:FC:05:70:B9; fixed-address 10.0.0.2;}
#host win2012servervm { hardware ethernet 58:9C:FC:09:62:E3; fixed-address 10.0.0.3;}


Why vm-public don't set 10.0.0.1 on start up as it's set in /etc/rc.conf? and why dhcpd doesn't issue IP addresses to hosts tap0, tap1, tap2, tap3 as stated as below:

host tap0rockyvm { hardware ethernet 58:9C:FC:10:F9:42; fixed-address 10.0.0.20;}
host tap1win2012servervm { hardware ethernet 58:9C:FC:10:20:2E; fixed-address 10.0.0.30;}
host tap2ubuntuvm { hardware ethernet 58:9C:FC:00:27:08; fixed-address 10.0.0.40;}
host tap3win2022servervm { hardware ethernet 58:9C:FC:10:FF:F6; fixed-address 10.0.0.50;}
 
Back
Top