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.
16 lines
475 B
Bash
16 lines
475 B
Bash
5 years ago
|
#!/bin/bash -e
|
||
|
|
||
|
address=$(ip address show dev eth0 scope global | grep -F 'inet ' | perl -pe 's#.*inet (.*?) .*#$1#')
|
||
|
gateway=$(ip route list dev eth0 default | perl -pe 's#.*via ##')
|
||
|
|
||
|
# $interface differs from the live system because of different naming schemes
|
||
|
# see https://wiki.debian.org/NetworkInterfaceNames for more details
|
||
|
interface='enp35s0'
|
||
|
|
||
|
|
||
|
echo "[Match]
|
||
|
Name=$interface
|
||
|
|
||
|
[Network]
|
||
|
Address=$address
|
||
|
Gateway=$gateway" > "/etc/systemd/network/${interface}.network"
|