convert bridge creation to service

update to systemd config files so that the bridge will be up
when systemd-networkd is started.

Signed-off-by: Tan Shen Joon <shen.joon.tan@intel.com>
Reviewed-by: Jack Ren <jack.ren@intel.com>
This commit is contained in:
Tan Shen Joon
2018-06-08 10:58:18 +08:00
committed by lijinxia
parent 48b0894d3d
commit b7ad7052bd
7 changed files with 42 additions and 55 deletions

View File

@@ -1,53 +0,0 @@
#!/bin/bash
# Instructions to create systemd-networkd configuration files:
if [ ! -e /etc/systemd/network ]; then
mkdir -p /etc/systemd/network
# /etc/systemd/network/acrn.network
cat <<EOF>/etc/systemd/network/acrn.network
[Match]
Name=e*
[Network]
Bridge=acrn-br0
EOF
# /etc/systemd/network/acrn.netdev
cat <<EOF>/etc/systemd/network/acrn.netdev
[NetDev]
Name=acrn-br0
Kind=bridge
EOF
# /etc/systemd/network/eth.network
cat <<EOF>/etc/systemd/network/eth.network
[Match]
Name=acrn-br0
[Network]
DHCP=ipv4
EOF
# need to mask 80-dhcp.network and 80-virtual.network
ln -s /dev/null /etc/systemd/network/80-dhcp.network
ln -s /dev/null /etc/systemd/network/80-virtual.network
# should get specifc list of taps
# /etc/systemd/network/acrn_tap0.netdev
cat <<EOF>/etc/systemd/network/acrn_tap0.netdev
[NetDev]
Name=acrn_tap0
Kind=tap
EOF
# restart systemd-network to create the devices
# and bind network address to the bridge
systemctl restart systemd-networkd
fi
# add tap device under the bridge
ifconfig acrn_tap0 up
brctl addif acrn-br0 acrn_tap0