Created
May 30, 2015 12:32
-
-
Save BtbN/38c6deb93c829f9ff722 to your computer and use it in GitHub Desktop.
network@.service setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")" | |
exec ./"$1"/down.sh "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")" | |
iface="$1" | |
echo "Removing unreachable route from lo..." | |
ip route del 2a01:4f8:190:83a8::/64 dev lo | |
echo "Flushing addresses..." | |
ip addr flush dev "$iface" | |
echo "Flushing routes..." | |
ip route flush dev "$iface" | |
ip -6 route flush dev "$iface" | |
echo "Downing interface..." | |
ip link set dev "$iface" down | |
echo "Done" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")" | |
iface="$1" | |
./down.sh "$iface" | |
echo "Bringing up interface ${iface}..." | |
ip link set dev "$iface" up | |
echo "Adding addresses..." | |
ip addr add 144.76.8.169 peer 144.76.8.161/32 dev "$iface" | |
ip addr add 144.76.21.59 peer 144.76.21.57/32 dev "$iface" | |
ip addr add 2a01:4f8:190:83a8::1/128 dev "$iface" | |
echo "Adding routes..." | |
ip route add default via 144.76.8.161 src 144.76.8.169 dev "$iface" | |
#ip route add default via 144.76.21.57 src 144.76.21.59 dev "$iface" | |
ip route add default via fe80::1 dev "$iface" | |
echo "Adding unreachable route to lo..." | |
ip route add 2a01:4f8:190:83a8::/64 dev lo | |
echo "Done" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")" | |
exec ./"$1"/up.sh "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Network connectivity (%i) | |
Wants=network.target | |
Before=network.target | |
BindsTo=sys-subsystem-net-devices-%i.device | |
After=sys-subsystem-net-devices-%i.device | |
[Service] | |
Type=oneshot | |
RemainAfterExit=yes | |
ExecStart=/etc/network/up.sh %i | |
ExecStop=/etc/network/down.sh %i | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment