wie kann ich in der /etc/network/interfaces erreichen, das LAN eine höhere Metric erhält, wenn es angestöpselt ist, als das WLAN?
/etc/network/interfaces
Code: Alles auswählen
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp0s31f6
iface enp0s31f6 inet dhcp
post-up /etc/network/if-up.d/routeaddLan
iface wlp5s0 inet dhcp
post-up /etc/network/if-up.d/routeaddWlan
Code: Alles auswählen
#!/bin/bash
set -e
INTERFACE=`ip addr show | grep -e ':\s*en' | awk '{print $2}' | cut -d: -f 1`
IP1=`ip addr show dev $INTERFACE | grep 'inet ' | awk '{print $2}' | cut -d/ -f 1`
SUBNET=`ip route show | grep 'default' | grep $INTERFACE | awk '{print $3}' | sed 's/0.1/0.0/'`
GATEWAY1=`ip route show | grep 'default' | grep $INTERFACE | awk '{print $3}'`
ip route add $SUBNET/20 dev $INTERFACE src $IP1 table srvnet
ip route add default via $GATEWAY1 dev $INTERFACE table sernet
ip rule add from $IP1/32 table srvnet
ip rule add to $IP1/32 table srvnet
Code: Alles auswählen
#!/bin/bash
set -e
INTERFACE=`ip addr show | grep -e ':\s*wl' | awk '{print $2}' | cut -d: -f 1`
IP1=`ip addr show dev $INTERFACE | grep 'inet ' | awk '{print $2}' | cut -d/ -f 1`
SUBNET=`ip route show | grep 'default' | grep $INTERFACE | awk '{print $3}' | sed 's/0.1/0.0/'`
GATEWAY1=`ip route show | grep 'default' | grep $INTERFACE | awk '{print $3}'`
ip route add $SUBNET/20 dev $INTERFACE src $IP1 table srvnet
ip route add default via $GATEWAY1 dev $INTERFACE table sernet
ip rule add from $IP1/32 table srvnet
ip rule add to $IP1/32 table srvnet
Code: Alles auswählen
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhepNetz
1 srvnet
Vielen Dank
Kaheto