Booting a diskless Debian system using bonding, bridging, and iSCSI
Solution 1:
It is defenitely interesting question and here is how I did a trick. My configuration is about the same as yours: Proxmox booting via iSCSI bridged interface. My grub boot line looks like this:
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0 ISCSI_INITIATOR=iqn.2007-08.com.example.client:client ISCSI_TARGET_NAME=iqn.2005-10.org.freenas.ctl:proxmox ISCSI_TARGET_IP=192.168.11.3 ISCSI_TARGET_PORT=3260 root=UUID=04709453-9d82-47d6-a898-81ea6408f88e ip=192.168.11.1:::255.255.255.0:client:vmbr2:off"
To boot with this grub configuration I need to start the bridge before grub mounts root. I make it by assigning a script in /etc/udev/rules.d/70-persistent-net.rules like this:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:30:48:94:61:ec", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="ens6f0", RUN+="/bin/brctl-iscsi ens6f0 vmbr2"
this /bin/brctl-iscsi script looks like this:
#!/bin/sh
ifconfig $1 mtu 9000 up
brctl addbr $2
brctl addif $2 $1
ip link set dev $2 type bridge forward_delay 0 stp_state 0
I also need a initramfs hook to put this script in initrd:
root@proxmox-2:~# cat /usr/share/initramfs-tools/hooks/brctl_iscsi
#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case "$1" in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
copy_exec /bin/brctl-iscsi /bin
And finally in /etc/network/interfaces I have this for iscsi interface and its bridge:
no-auto-down ens6f0
no-auto-down vmbr2
iface ens6f0 inet manual
iface vmbr2 inet manual
address 192.168.11.2
netmask 255.255.255.0
bridge-ports ens6f0
bridge-stp off
bridge-fd 0
down ifconfig vmbr2 down; brctl delbr vmbr2
#iSCSI network
That's it Regards, Dmitry