Skip to content

Instantly share code, notes, and snippets.

@xueliu
Created October 13, 2021 10:25
Show Gist options
  • Save xueliu/942c6809b08315b587ded2f42049f1bf to your computer and use it in GitHub Desktop.
Save xueliu/942c6809b08315b587ded2f42049f1bf to your computer and use it in GitHub Desktop.
BuildRoot vexpress-a9 boot from NFS ifup
#!/bin/sh
set -x
if [ -n "$1" ];then
ip link add ${SWITCH} type bridge
sleep 1s
ip tuntap add $1 mode tap user `whoami`
sleep 0.5s
ip link set dev ${SWITCH} up
sleep 0.5s
ip link set dev ${ETHERNET_PORT} master ${SWITCH}
sleep 0.5s
ip link set $1 up
sleep 0.5s
ip link set $1 master ${SWITCH}
ip address delete ${HOST_IP}/24 dev ${ETHERNET_PORT}
ip address add ${HOST_IP}/24 dev ${SWITCH}
ip route add default via ${HOST_IP} dev ${SWITCH}
exit 0
else
echo "Error: no interface specified"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment