Gentoo Archives: gentoo-user

From: Michael <confabulate@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Multiple addresses/routes for one ethernet card possible?
Date: Sat, 24 Oct 2020 08:41:39
Message-Id: 4065152.ejJDZkT8p0@dell_xps
In Reply to: [gentoo-user] Multiple addresses/routes for one ethernet card possible? by Walter Dnes
1 On Saturday, 24 October 2020 05:55:54 BST Walter Dnes wrote:
2 > After an outage on VDSL last month, I got a backup 10/1 cable
3 > subscription backup. Switching is a bit of a hassle. In addition to
4 > swapping cables, I have to run dhcpcd as root or sudo when swithching
5 > from VDSL to cable. Switching back I have to run "dhcpcd -x", copy over
6 > my backup of /etc/resolve.conf, and run "/etc/init.d/net.eth0 restart".
7 >
8 > The VDSL router/modem offers dhcp and static address space at
9 > 192.168.1.0/24, DNS and default GW 192.168.1.1. I've bought a router
10 > that gets a WAN address from the cable modem via dhcpcd, and offers dhcp
11 > and static address space at 192.168.10.0/24, DNS and default GW
12 > 192.168.10.1. My current /etc/conf.d/net is...
13 >
14 > mtu_eth0="1466"
15 > config_eth0="
16 > 192.168.1.249/24 broadcast 192.168.1.255"
17 > routes_eth0="
18 > default via 192.168.1.1 metric 20
19 > 192.168.1.240/28 via 192.168.1.1 metric 0"
20 >
21 > ...for my machine 192.168.1.249. Can I have something like...
22 >
23 > mtu_eth0="1466"
24 > config_eth0="
25 > 192.168.1.249/24 broadcast 192.168.1.255
26 > 192.168.10.249/24 broadcast 192.168.1.255"
27 > routes_eth0="
28 > default via 192.168.1.1 metric 20
29 > 192.168.1.240/28 via 192.168.1.1 metric 0"
30 >
31 > ... and how would I tweak the last two lines to work without changes
32 > each time I switch between VDSL (192.168.1.1) and cable (192.168.10.1) ?
33
34
35 In file '/usr/share/doc/netifrc-0.7.1/net.example.bz2' examples are given to
36 set up interface gateways using arping. In your case I think something like
37 this ought to work:
38
39 ###############
40 mtu_eth0="1466"
41
42 gateways_eth0="192.168.1.1 192.168.10.1"
43
44 config_192168001001="192.168.1.249/24"
45 routes_192168001001="default via 192.168.1.1"
46 dns_servers_192168001001="192.168.1.1"
47
48 config_192168010001="192.168.10.249/24"
49 routes_192168010001="default via 192.168.10.1"
50 dns_servers_192168010001="192.168.10.1"
51 ###############
52
53 If you physically plug and unplug the ethernet cable from the PC to either
54 router each time, the PC's IP address will be set statically according to the
55 router's LAN address.
56
57 However, if only one router is connected to the PC at any time, my personal
58 preference would be to use the *same* LAN subnet on both routers and configure
59 the routers' static IP address allocation to the same IP address for the PC's
60 MAC.
61
62 An alternative would be to have the PC connected to both routers over a
63 managed switch and then use a more involved configuration to monitor the VDSL
64 connection by pinging an Internet address, or the next hop to the ISP's
65 gateway, or their DNS servers. When multiple pings fail, the routing would be
66 switched over from VDSL to the Cable router. This would be a more convoluted
67 set up, probably using a post-up script to do the failover monitoring and re-
68 routing. I don't have a working netifrc setup to share, but professional
69 grade managed switches/routers should be able to do this if you don't want to
70 do it on the PC itself.

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] Multiple addresses/routes for one ethernet card possible? Walter Dnes <waltdnes@××××××××.org>