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:
My dhcpd.conf is as follows:
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:
And /etc/rc.conf
When I also start my Virtual Machines, interfaces and virtual router don't have IP address assigned. I have to manually type:
What am I missing?
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"
ifconfig tap3 inet 10.0.0.40 netmask 255.0.0.0 What am I missing?