3 source /etc/default/snf-network
7 if [ ! -e $STATE_DIR/infra ]; then
8 echo No infra file found!
9 echo run: snf-network-build-node-infra
13 source $STATE_DIR/infra
16 echo "Usage: $0 <routing table> <subnet> <gateway> <subnet6> <gateway6>"
20 RT_TABLES=/etc/iproute2/rt_tables
30 ARP_IP=$(ipcalc $SUBNET | grep HostMax | awk '{print $2}')
34 if [ -n "$SUBNET" ]; then
35 arptables -D OUTPUT -o $VLAN --opcode request -j mangle --mangle-ip-s $ARP_IP
36 if [ -n "$GATEWAY" ]; then
37 ip route del default via $GATEWAY dev $VLAN table $TABLE
39 ip route del $SUBNET dev $VLAN table $TABLE
40 ip route del $SUBNET dev $VLAN table main
41 ip rule del iif $VLAN table $TABLE
44 if [ -n "$SUBNET6" ]; then
45 if [ -n "$GATEWAY6" ]; then
46 ip -6 route del default via $GATEWAY6 dev $VLAN table $TABLE
48 ip -6 route add $SUBNET6 dev $VLAN table $TABLE
49 ip -6 route add $SUBNET6 dev $VLAN table main
50 ip -6 rule add iif $VLAN table $TABLE
53 sed -i 's/.*'"$TABLE"'$//' $RT_TABLES