#! /bin/sh jailName="$1" # ifconfig returns new epair name as outpout epairA="$(ifconfig epair create)" # the second intervace has got b at the end epairB="${epairA%?}b" # We rename the interface from the generated name to be te same like jail's name # The maxium lenght of network interface is about 15 character which souhld be enough ifconfig $epairA name A$jailName ifconfig A$jailName up ifconfig bridge0 addm A$jailName up ifconfig $epairB name B$jailName # The line below would only work if called from exec.created section #ifconfig eth0 vnet $jailName up # insipration from https://forums.freebsd.org/threads/jails-vnet-freebsd-mastery-multiple-interfaces.70356/ # to list only epair interfaces you can you can use # ifconfig -g epair -l