Skip to content

Instantly share code, notes, and snippets.

@doracl
Forked from ismell/setup-bridge.sh
Created May 18, 2017 03:39
Show Gist options
  • Select an option

  • Save doracl/a44c7b83f9aaf8b02cfb10bd3ee63994 to your computer and use it in GitHub Desktop.

Select an option

Save doracl/a44c7b83f9aaf8b02cfb10bd3ee63994 to your computer and use it in GitHub Desktop.

Revisions

  1. @ismell ismell revised this gist Oct 3, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup-bridge.sh
    Original file line number Diff line number Diff line change
    @@ -9,4 +9,4 @@ if [[ ! ip link show docker0 ]]; then
    iptables -t nat -A POSTROUTING -s "$IFADDR" ! -d "$IFADDR" -j MASQUERADE
    fi

    cat 1 > /proc/sys/net/ipv4/ip_forward
    echo 1 > /proc/sys/net/ipv4/ip_forward
  2. @ismell ismell revised this gist Sep 24, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion setup-bridge.sh
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    #!/bin/bash -e

    IFADDR="192.168.3.0/24"
    IFADDR="192.168.3.1/24"

    if [[ ! ip link show docker0 ]]; then
    ip link add docker0 type bridge
  3. @ismell ismell revised this gist Sep 24, 2013. 2 changed files with 6 additions and 1 deletion.
    2 changes: 1 addition & 1 deletion setup-bridge.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/bash
    #!/bin/bash -e

    IFADDR="192.168.3.0/24"

    5 changes: 5 additions & 0 deletions teardown-bridge.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    #!/bin/bash -e

    iptables -t nat -F
    ifconfig docker0 down
    brctl delbr docker0
  4. @invalid-email-address Anonymous created this gist Sep 24, 2013.
    12 changes: 12 additions & 0 deletions setup-bridge.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash

    IFADDR="192.168.3.0/24"

    if [[ ! ip link show docker0 ]]; then
    ip link add docker0 type bridge
    ip addr add "$IFADDR" dev docker0
    ip link set docker0 up
    iptables -t nat -A POSTROUTING -s "$IFADDR" ! -d "$IFADDR" -j MASQUERADE
    fi

    cat 1 > /proc/sys/net/ipv4/ip_forward