On Saturday, 24 October 2020 05:55:54 BST Walter Dnes wrote:
>   After an outage on VDSL last month, I got a backup 10/1 cable
> subscription backup.  Switching is a bit of a hassle.  In addition to
> swapping cables, I have to run dhcpcd as root or sudo when swithching
> from VDSL to cable.  Switching back I have to run "dhcpcd -x", copy over
> my backup of /etc/resolve.conf, and run "/etc/init.d/net.eth0 restart".
> 
>   The VDSL router/modem offers dhcp and static address space at
> 192.168.1.0/24, DNS and default GW 192.168.1.1.  I've bought a router
> that gets a WAN address from the cable modem via dhcpcd, and offers dhcp
> and static address space at 192.168.10.0/24, DNS and default GW
> 192.168.10.1. My current /etc/conf.d/net is...
> 
> mtu_eth0="1466"
> config_eth0="
> 192.168.1.249/24 broadcast 192.168.1.255"
> routes_eth0="
> default via 192.168.1.1 metric 20
> 192.168.1.240/28 via 192.168.1.1 metric 0"
> 
> ...for my machine 192.168.1.249.  Can I have something like...
> 
> mtu_eth0="1466"
> config_eth0="
> 192.168.1.249/24 broadcast 192.168.1.255
> 192.168.10.249/24 broadcast 192.168.1.255"
> routes_eth0="
> default via 192.168.1.1 metric 20
> 192.168.1.240/28 via 192.168.1.1 metric 0"
> 
> ... and how would I tweak the last two lines to work without changes
> each time I switch between VDSL (192.168.1.1) and cable (192.168.10.1) ?


In file '/usr/share/doc/netifrc-0.7.1/net.example.bz2' examples are given to 
set up interface gateways using arping.  In your case I think something like 
this ought to work:

###############
mtu_eth0="1466"

gateways_eth0="192.168.1.1 192.168.10.1"

config_192168001001="192.168.1.249/24"
routes_192168001001="default via 192.168.1.1"
dns_servers_192168001001="192.168.1.1"

config_192168010001="192.168.10.249/24"
routes_192168010001="default via 192.168.10.1"
dns_servers_192168010001="192.168.10.1"
###############

If you physically plug and unplug the ethernet cable from the PC to either 
router each time, the PC's IP address will be set statically according to the 
router's LAN address.

However, if only one router is connected to the PC at any time, my personal 
preference would be to use the *same* LAN subnet on both routers and configure 
the routers' static IP address allocation to the same IP address for the PC's 
MAC.

An alternative would be to have the PC connected to both routers over a 
managed switch and then use a more involved configuration to monitor the VDSL 
connection by pinging an Internet address, or the next hop to the ISP's 
gateway, or their DNS servers.  When multiple pings fail, the routing would be 
switched over from VDSL to the Cable router.  This would be a more convoluted 
set up, probably using a post-up script to do the failover monitoring and re-
routing.  I don't have a working netifrc setup to share, but professional 
grade managed switches/routers should be able to do this if you don't want to 
do it on the PC itself.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to