bridge-start 741 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/sh
  2. #################################
  3. # Set up Ethernet bridge on Linux
  4. # Requires: bridge-utils
  5. #################################
  6. # Define Bridge Interface
  7. br="br0"
  8. # Define list of TAP interfaces to be bridged,
  9. # for example tap="tap0 tap1 tap2".
  10. tap="tap0"
  11. # Define physical ethernet interface to be bridged
  12. # with TAP interface(s) above.
  13. eth="eth0"
  14. eth_ip="192.168.8.4"
  15. eth_netmask="255.255.255.0"
  16. eth_broadcast="192.168.8.255"
  17. for t in $tap; do
  18. openvpn --mktun --dev $t
  19. done
  20. brctl addbr $br
  21. brctl addif $br $eth
  22. for t in $tap; do
  23. brctl addif $br $t
  24. done
  25. for t in $tap; do
  26. ifconfig $t 0.0.0.0 promisc up
  27. done
  28. ifconfig $eth 0.0.0.0 promisc up
  29. ifconfig $br $eth_ip netmask $eth_netmask broadcast $eth_broadcast