Skip to content

Instantly share code, notes, and snippets.

@mwoodbri
Last active May 6, 2017 14:13
Show Gist options
  • Save mwoodbri/3cdd31ebc844da84c3b7061f38803853 to your computer and use it in GitHub Desktop.
Save mwoodbri/3cdd31ebc844da84c3b7061f38803853 to your computer and use it in GitHub Desktop.
tinc
ADDRESS=10.10.0.2
CLIENT=$(hostname -s)
yum install -y epel-release
yum install -y tinc
mkdir -p /etc/tinc/hosts
cat >/etc/tinc/tinc.conf <<EOF
Name=$CLIENT
ConnectTo=vp1
EOF
tincd -K </dev/null
sed -i "1i Subnet=$ADDRESS" /etc/tinc/hosts/$CLIENT
cat >/etc/tinc/tinc-up <<EOF
#!/bin/sh
ifconfig \$INTERFACE $ADDRESS netmask 255.255.255.0
EOF
chmod u+x /etc/tinc/tinc-up
cat >>/etc/rc.d/rc.local <<'EOF'
tincd
EOF
cat /etc/tinc/hosts/$CLIENT
ADDRESS=10.10.0.1
SERVER=$(hostname -s)
yum install -y epel-release
yum install -y tinc
mkdir /etc/tinc
cat >/etc/tinc/tinc.conf <<EOF
Name=$SERVER
EOF
mkdir -p /etc/tinc/hosts
tincd -K </dev/null
sed -i "1i Subnet=$ADDRESS" /etc/tinc/hosts/$SERVER
cat >/etc/tinc/tinc-up <<EOF
#!/bin/sh
ifconfig \$INTERFACE $ADDRESS netmask 255.255.255.0
EOF
chmod u+x /etc/tinc/tinc-up
cat >>/etc/rc.d/rc.local <<'EOF'
tincd
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment