How to raise 2 pppoe connections at the same time on 2 network cards on the server?

Hello dear. I'm sorry, can not there I write, it's my first post.
Russian language is not my mother tongue, if there are amendments, I would be grateful.

The question arose. I crawled Google looking for the answer to this question...

The house there is a server machine with utanovleny her Ddebian.
4 the Network interface:
1 eth0 smotryashy to the network provider via dhcp
2 eth1 smotryashy into the same network of the provider on dhcp (comes home 2 Internet one 65 MB,with pay and the second is 10 MB.with the globe as I am an employee of the same provider, I deserve it)
both connections use PPPoE connection type
3 eth2 looks in the unmanaged hub and from the hub on 2 desktop machines configured this interface on the distribution of DHCP
4 wlan0 is not configured yet but it is planned to distribute an Internet through the air on a laptop 2


How can I raise 2 pppoe connections at the same time on 2 network cards on the server? How to set auto switch between them in case of a fall eth0 (for example when money in the account is over) + give Internet to LAN via eth2 and wlan0 + installed on the server, bind9, apache, mysql, ftp and vpn to be used from the outside through the interface that is active at a given time, whether it is eth0 or eth1.

PS the ISP does not give static settings on connecting everything via DHCP.
P. P. S. Please do not beat on the first post and used the search, found nothing, please help who can. All the hair on the head is already ripped.
October 3rd 19 at 01:42
1 answer
October 3rd 19 at 01:44
In the folder /etc/ppp/ip-down.d and /etc/ppp/ip-up.d can are scripts that are run every time when lifting the network connection.
The script is passed to the toe settings
$1 - PPP interface name, $2 - tty, $3 - PPP link speed, $4 - local IP address, $5 remote IP
Surely some of them have different providers from this we can include processing cycles and write behaviors.
Bring your I primitive was not written for it.


if [ "$3" = "150" ]
route add default gw `ip route show|grep $5|awk '{ print $3 }"
route del-host `ip route show|grep $5|sed 's/via/gw/g"


if [ "$3" = "150" ]
route add -host $5 gw `ip route show|grep default|awk '{print $3" "$4" "$5}"
route del default
route add default dev $1

Find more questions by tags DebianDHCPNetwork administration