pastebin - collaborative debugging tool
rovema.kpaste.net RSS

Difference between
modified post 725f by Anonymous on Thu 14th Apr 2022 12:47
original post de0f by Anonymous on Thu 14th Apr 2022 12:47
Download diff
Show old version | new version | both versions

    
11
#!/usr/bin/ksh93
22
33
#
44
# Ethernet/tap forwarding via ssh
55
#
66
77
set -o xtrace
88
set -o errexit
99
set -o nounset
1010
1111
# list of commands our ssh session should execute
1212
typeset -a sshcmds=(
1313
	"set -o xtrace ;"
1414
	"set -o errexit ;"
1515
	"brctl addbr br19 ;"
1616
	"brctl addif br19 tap19 ;"
1717
	"brctl addif br19 eno1 ;"
1818
	"brctl show ;"
1919
	"ifconfig tap19 promisc ;"
2020
	"ifconfig tap19 up ;"
2121
	"ifconfig br19 up ;"
2222
2323
	"set +o errexit ;"
2424
2525
	"read dummy ;" # dummy wait
2626
2727
	#
2828
	# cleanup:
2929
	#
3030
	# we need to clean up the bridge interface ourselves, if
3131
	# we do not do that we risk getting that any subsequent
3232
	# ifconfig/ip/etc command hangs
3333
	#
3434
	"brctl delif br19 tap19 ;"
3535
	"brctl delif br19 eno1 ;"
3636
	"ifconfig tap19 down ;"
3737
	"ifconfig br19 down ;"
3838
	"brctl delbr br19 ;"
3939
	'kill -s HUP -${PPID} ;'
4040
)
4141
4242
ssh \
4343
	-o ExitOnForwardFailure=yes \
4444
	-o PermitLocalCommand=yes \
4545
	-o LocalCommand="ifconfig tap19 up" \
4646
	-o Tunnel=ethernet -w 19:19 \
4747
	root@10.49.20.202 \
4848
	"${sshcmds[*]}"
4949
5050
# cleanup
5151
# ...
5252
5353
# EOF.
5454
5555

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at