iocage with DHCP and VNET enabled show different MAC address for ether and hwaddr

Status
Not open for further replies.

Cytomax

Explorer
Joined
Nov 29, 2015
Messages
67
Running FreeNAS-11.2-BETA1
I want to be able to have a unique MAC address for my jails so i can control the IP given to it via my pfsense router

Why do i have 2 different values for ether and hwaddr?




I created an emby jail with this

wget https://raw.githubusercontent.com/MediaBrowser/iocage-amd64/master/emby-server.json

iocage fetch -P --name emby-server.json ip4_addr="vtnet0|192.168.0.4/24



I then enabled
DHCP Autoconfigure IPv4
VNET


Restarted FreeNAS


ifconfig on FreeNAS shows

net0:1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
description: associated with jail: emby-server
options=8<VLAN_MTU>
ether 02:ff:60:be:c1:74
hwaddr 02:17:10:00:06:0a

nd6 options=1<PERFORMNUD>
media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
status: active
groups: epair





ifconfig on emby jail shows

epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 02:ff:60:be:c1:75
hwaddr 02:17:10:00:07:0b

inet 192.168.0.83 netmask 0xffffff00 broadcast 192.168.0.255
nd6 options=1<PERFORMNUD>
media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
status: active
groups: epair



Why do i have 2 different values for ether and hwaddr?


Thanks in advance
 
D

dlavigne

Guest
Does the issue persist in BETA2? If so, please create a report at bugs.freenas.org and post the issue number here.
 

Cytomax

Explorer
Joined
Nov 29, 2015
Messages
67
I reverted back to 11.1 u 5 but i can try on different hardware when I get home and let you know
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I don't recall the difference between the two addresses, but this has been the case on every iocage jail I've created (I'm on 11.1-U1 I think). You can set these as part of your iocage command to create the jail. I'll set a reminder to look up an example later today.
 

Cytomax

Explorer
Joined
Nov 29, 2015
Messages
67
i was under the impression that you couldnt specify your MAC address in iocage... at least not yet or the feature hadnt been implemented.. what is the command to specify the MAC address?
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I don't have the details at hand, but I have multiple iocage scripts that set the MAC and rely on DHCP to get the IP. I'll have access to an example that I can post in a few hours.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Here's an example iocage script that creates a jail using DHCP. It'll print out the jail name, ip, and MAC address. Configure your router, press Enter, and the script will continue to create the jail and then print out the ifconfig and MAC info.

Don't forget to configure your IP range and iocage pool location.

Code:
#!/usr/local/bin/bash

JAIL_NAME="dhcp_test"
JAIL_IP_OCTET=42 # 10.0.0.xxx

JAIL_IP_OCTET_HEX="$(printf '%x' ${JAIL_IP_OCTET})"
JAIL_IP="10.0.0.${JAIL_IP_OCTET}"
MAC_ADR="02:ff:60:00:${JAIL_IP_OCTET_HEX}:00"
MAC_INT="02:ff:60:00:${JAIL_IP_OCTET_HEX}:01"

echo "configure your router to assign $JAIL_NAME $JAIL_IP $MAC_ADR. Press Enter to continue."
read

set -x

# try to stop and destroy the old iocage jail if it exists
# if this fails, just try the script a second time
iocage stop "$JAIL_NAME"
iocage destroy --force --recursive "$JAIL_NAME"
set -e
zfs list -r tank/iocage/jails/"$JAIL_NAME" &>/dev/null && \
	zfs destroy -r tank/iocage/jails/"$JAIL_NAME"


echo '{"pkgs":[
	"bash",
	"ca_root_nss"
]}' > /tmp/pkg.json

# this is the part that creates the jail (vent, bps, dhcp, vnet0_mac are the key parts)
# "interfaces" may have been part of the pre-U6 network fixes.
# It may or may not be needed or need to be adjusted based on your configuration.
iocage create \
	-n "$JAIL_NAME" \
	-p /tmp/pkg.json \
	-r 11.1-RELEASE \
	boot=on \
	allow_raw_sockets=1 \
	vnet=on \
	bpf=yes \
	dhcp=on \
	vnet0_mac="${MAC_INT//:/}","${MAC_ADR//:/}" \
	interfaces="vnet0:bridge1"

rm /tmp/pkg.json

iocage exec "$JAIL_NAME" ifconfig vnet0 ether
iocage get vnet0_mac "$JAIL_NAME"
 
Status
Not open for further replies.
Top