0

I have a specific route(in a policy route table) via a pppoe interface:

ppp1      Link encap:Point-to-Point Protocol  
          inet addr:61.48.180.187  P-t-P:61.48.180.1  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:30 (30.0 B)  TX bytes:30 (30.0 B)

and

$sudo ip route ls table CMCC2
default dev ppp1  scope link

Due to some reason, I want to poff then pon the pppoe interface regularly, but each time after I poff the interface the route default dev ppp1 will be deleted. And after pon the interface, I have to manually add it back again. Is there a way to prevent that? I mean deleting the interface ppp1 but keeping the route default dev ppp1 not deleted?

armnotstrong
  • 139
  • 7

1 Answers1

0

Why not just write a script that runs pon, checks for it's successful completion and then runs the routing command ?

#!/bin/bash
pon some parameters || { echo "Failed to bring up PPP link" ; exit 1 ; }
route add some stuff here
user9517
  • 115,471
  • 20
  • 215
  • 297
  • I found that after `pon` there is a chance that the interface may not be brought up immediately, and yes, I can wait until it is up, but I thought if there is a way which could keep the route not deleted will be more elegant. – armnotstrong Feb 25 '16 at 09:45
  • Stop and think about that for a moment ... – user9517 Feb 25 '16 at 09:48