Skip to content

Instantly share code, notes, and snippets.

@Madji
Forked from mwoodbri/client.sh
Created May 6, 2017 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Madji/43d6ce4b439d7c17d7580bec8e16d411 to your computer and use it in GitHub Desktop.
Save Madji/43d6ce4b439d7c17d7580bec8e16d411 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