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.
40 lines
1.1 KiB
Bash
40 lines
1.1 KiB
Bash
#!/bin/bash -e
|
|
|
|
default_routev4=$(ip route list | grep -F 'default')
|
|
|
|
interface=$(echo "$default_routev4" | perl -pe 's#^.* dev (\w+) .*$#$1#')
|
|
macaddress=$(ip address show dev "$interface" | grep -F 'link/ether' | perl -pe 's#^.*link/ether ([a-z0-9:]*) brd .+$#$1#')
|
|
|
|
addresses=$(ip address show dev "$interface" scope global)
|
|
|
|
gatewayv4=$(echo "$default_routev4" | perl -pe 's#^.* via ([\d.]+) .*$#$1#')
|
|
addressv4=$(echo "$addresses" | grep -F 'inet ' | perl -pe 's#^.* inet ([\d.]+).*#$1#')
|
|
|
|
addressv6=$(echo "$addresses" | grep -F 'inet6 ' | perl -pe 's#^.* inet6 ([a-z0-9:]+)::[a-z0-9]+.*$#$1#')
|
|
|
|
|
|
echo "[Match]
|
|
MACAddress=$macaddress
|
|
|
|
[Network]
|
|
Gateway=$gatewayv4
|
|
Gateway=fe80::1
|
|
Address=116.202.199.132/32
|
|
Address=116.202.199.133/32
|
|
Address=116.202.199.134/32
|
|
Address=116.202.199.143/32
|
|
Address=176.9.141.113/32
|
|
Address=176.9.141.119/32
|
|
Address=176.9.141.124/32
|
|
Address=176.9.141.125/32
|
|
Address=5.9.203.242/32
|
|
Address=5.9.203.246/32
|
|
Address=5.9.203.247/32
|
|
|
|
[Address]
|
|
Address=${addressv4}/32
|
|
Peer=${gatewayv4}/32
|
|
|
|
[Address]
|
|
Address=${addressv6}::1337/64" > "/etc/systemd/network/internet.network"
|