Last active
November 12, 2016 20:58
-
-
Save tuklusan/ab2796e869f9e236eeff4f72c901baf0 to your computer and use it in GitHub Desktop.
tap-setup.sh from How to Build Your Own Digital DEC MicroVAX 3900 Running OpenVMS VAX VMS Operating System: SIMH on CentOS 7 Running OpenVMS/VAX 7.3: http://supratim-sanyal.blogspot.com/2016/10/how-to-build-your-own-digital-dec.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# tap-setup.sh | |
# | |
# Sets up a bridge br0 to the physical ethernet adapter and a tap tap0 for connecting from SIMH | |
# Also creates additional taps tap1 and tap2 for use if needed by other programs | |
# Build your own SIMH Micro VAX 3900 running OpenVMS VAX 7.3: | |
# http:/supratim-sanyal.blogspot.com/2016/09/how-to-build-your-own-digital-dec.html | |
# | |
# Modified from simh documentation by Supratim Sanyal <supratim at riseup dot net> | |
# | |
# ==== | |
# Change the DEVICE name below to your actual network interface name. | |
# Important: Make sure there is only one IP address assigned to the interface. | |
# ==== | |
# | |
DEVICE="ens33" | |
# ---- | |
# No more changes should be required from here | |
/bin/echo `/bin/date` ---- BEFORE BRIDGE AND TAP ---- | |
/sbin/ip addr | |
/bin/echo `/bin/date` ROUTE | |
/sbin/ip route show | |
/bin/echo `/bin/date` ------------------------------- | |
HOSTIPANDMASK=`ip addr show dev $DEVICE | grep inet | head -1 | cut -f 6 -d " "` | |
HOSTIP=`echo $HOSTIPANDMASK|cut -f 1 -d "/"` | |
HOSTNETMASK=`echo $HOSTIPANDMASK|cut -f 2 -d "/"` | |
HOSTBCASTADDR=`ip addr show dev $DEVICE | grep inet | head -1 | cut -f 8 -d " "` | |
HOSTDEFAULTGATEWAY=`/sbin/route -n | grep ^0.0.0.0 | gawk -- '{ print $2 }'` | |
/bin/echo `/bin/date` " " | |
/bin/echo `/bin/date` ---- GATHERED INFORMATION ----- | |
/bin/echo `/bin/date` HOSTIP=$HOSTIP HOSTNETMASK=$HOSTNETMASK HOSTBCASTADDR=$HOSTBCASTADDR HOSTDEFAULTGATEWAY=$HOSTDEFAULTGATEWAY | |
/bin/echo `/bin/date` ------------------------------- | |
# Create the TAP network devices | |
/sbin/ip tuntap add dev tap0 mode tap | |
/sbin/ip link set dev tap0 up | |
/sbin/ip tuntap add dev tap1 mode tap | |
/sbin/ip link set dev tap1 up | |
/sbin/ip tuntap add dev tap2 mode tap | |
/sbin/ip link set dev tap2 up | |
/bin/sleep 1 | |
# Bridge $DEVICE to br0 | |
/sbin/brctl addbr br0 | |
/sbin/brctl addif br0 $DEVICE | |
/sbin/brctl setfd br0 0 | |
/sbin/ip addr flush dev $DEVICE | |
/sbin/ip addr add $HOSTIPANDMASK broadcast $HOSTBCASTADDR dev br0 | |
/sbin/ip link set dev br0 up | |
/bin/sleep 1 | |
# bridge in the tap devices | |
/sbin/brctl addif br0 tap0 | |
/sbin/ip addr flush dev tap0 | |
/bin/sleep 1 | |
/sbin/brctl addif br0 tap1 | |
/sbin/ip addr flush dev tap1 | |
/bin/sleep 1 | |
/sbin/brctl addif br0 tap2 | |
/sbin/ip addr flush dev tap2 | |
/bin/sleep 1 | |
# set the default route to the br0 interface | |
/sbin/ip route replace default via $HOSTDEFAULTGATEWAY dev br0 | |
/bin/sleep 1 | |
/bin/echo `/bin/date` " " | |
/bin/echo `/bin/date` ---- AFTER BRIDGE AND TAP ---- | |
/sbin/ip addr | |
/bin/echo `/bin/date` ROUTE | |
/sbin/ip route show | |
/bin/echo `/bin/date` BRIDGE | |
/sbin/brctl show | |
/bin/echo `/bin/date` ------------------------------- | |
# -- | |
# We can now run SIMH VAX simulator and "attach xq tap:tap0" in vax.ini | |
# -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Typical working output of the script: