You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
752 B
Bash
27 lines
752 B
Bash
3 weeks ago
|
#!/bin/sh
|
||
|
set -eu
|
||
|
|
||
|
. ./lib.shs
|
||
|
|
||
|
# typically: bring up the networks
|
||
|
ip link set dev lo up
|
||
|
|
||
|
setup_for_router
|
||
|
|
||
|
# uplink
|
||
|
# glue networks for both AFs
|
||
|
ip addr add 100.64.254.2/30 dev up_ve
|
||
|
ip addr add 2a01:4f8:c0c:36b8:fffe::2/126 dev up_ve
|
||
|
# (cg)NAT: use 10.0.0.0/24 inside the network and 192.168.0.1/24 for the client network
|
||
|
nft add table ip nat
|
||
|
nft add chain ip nat postrouting { type nat hook postrouting priority srcnat \; }
|
||
|
nft add rule ip nat postrouting oifname \"up_ve\" ip saddr 10.0.0.0/24 masquerade
|
||
|
ip link set dev up_ve up
|
||
|
ip route add default via 100.64.254.1 dev up_ve
|
||
|
ip route add default via 2a01:4f8:c0c:36b8:fffe::1 dev up_ve
|
||
|
|
||
|
# network for APs
|
||
|
ip addr add 10.0.0.1/24 dev ap_ve
|
||
|
# No IPv6 at public spaces lol
|
||
|
ip link set dev ap_ve up
|