On 03/26/2017 08:30 AM, Cindy-Sue
Causey wrote:
Typically user's put a second gateway option in the /etc/network/interface file (which you talk about in the next paragraph). This usually results in not understanding what the gateway does. While I've never put duplicate gateway information in /etc/network/interfaces I, at one point when learning about networking and setting it up in Debian, had put a gateway for each subnet in the interfaces file (which is incorrect and resulted in an error). A gateway, often called a "gateway of last resort" tells the system how to reach subnets that it is not attached to. That is the point of the gateway; it is the one place the system can send packets to when it doesn't know where to go. If you defined two gateways (meaning if this was allowed) you would be back to square one, the system wouldn't know which gateway to send the packet to. Defining two gateways could be an incorrect way of saying you are defining two routes (most likely static routes).What I encountered wasn't about declaring different values for gateway, either. For whatever reasons due to innate [functionality], it becomes a fail even if you declare the same gateway value for that line within each new, separate block of declarations. Success is found by declaring it once then omitting that line within any other new blocks added over time. I hadn't really thought about this myself. I've always defined the gateway under the interface that is attached to the subnet where the gateway resides. A.K.A. if I have two networks:Between my setup and cognition, I've never had anything stable enough to test if it matters which block that gateway is declared. I've wondered if it matters that it be in the first block, or if it just needs to show up somewhere in that file. I was consciously putting it in the first block because that seemed to be the *logical* thing to do k/t having touched on programming 20 years ago at a local tech school. auto eth0 iface inet eth0 static address 192.168.0.2/24 auto eth1 iface inet eth1 static address 10.1.10.2/24 And my gateway of last resort was on the 192.168.0 subnet then I would define the gateway under that interface auto eth0 iface inet eth0 static address 192.168.0.2/24 gateway 192.168.0.1 It never occurred to me to see if it could be put anywhere in the file. My hunch is it can and I guess I could take the 60 seconds to test it, but I'll leave that to more adventurous people. Thanks, Joshua Schaeffer |