25 lines
903 B
Bash
25 lines
903 B
Bash
#!/bin/sh
|
|
#
|
|
# This script is for creating a bridge interface, assigning an IP address, and adding physical interface enp2s0 to it.
|
|
|
|
# Create bridge
|
|
ip link add type bridge
|
|
# name is non deterministic, fix
|
|
# Two addresses are given, one for wireguard peer and one for L2TP tunnel. Seperate addresses are required because the wireguard peer will have one route over the internet, and another route through the wireguard network.
|
|
ip address add 200.1.0.2/16 dev bridge0
|
|
ip address add 200.1.0.3/16 dev bridge0
|
|
|
|
# Change bridge0 mac address to not conflict with bridge interface of other wireguard peer
|
|
ip link set bridge0 address d6:05:05:32:d1:5d
|
|
|
|
# Add physical nic to bridge
|
|
ip link set enp2s0 master bridge0
|
|
ip link set enp2s0 up
|
|
ip link set bridge0 up
|
|
|
|
# Static Routes
|
|
# default
|
|
ip route add default via 200.1.0.1
|
|
# to reach l2tp tunnel interface through wg0
|
|
ip route add 200.1.0.4/32 via 192.168.1.2
|