Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
SDN 101: An Introduction to Software Defined Networking
Discover the advantages of SDN.
SDN has quickly become one of the hottest trends in IT. But not all SDN solutions offer real software-defined functionality. As more enterprises consider SDN, they want to know, “What is SDN? And what are the real benefits?” If you're ready to explore the advantages of SDN, and want to know how it should be implemented within your enterprise, start by reading our introductory white paper.
Click Here to receive this Complete Guide absolutely free.
I've got a Ubuntu 11.04 VM that I'm trying to setup a backup LAN route on. It's a migration of a physical machine onto a VMWare ESXi white box. I've got a backup LAN setup on the ESXi white box using wireless and I wanted to be able to allow this VM to use that backup network if the regular hardwired LAN is down for some reason.
The problem I'm having is that I can't seem to prevent the hardwired primary LAN default route from being active as long as eth0 is up, even if the link is down (i.e. no cable connected). When that happens if I try to connect to the system via the backup wireless lan subnet, the routing table sends the packets back over the primary default gateway route, which of course is down. I can fix this by doing "ifdown eth0" which clears the routing table of the primary lan default route, leaving the backup default route (which has a higher metric #) active, but I'd like that functionality to work simply by virtue of whether or not the link state is up versus having to do that manually. Is there any way to do that? I've tried using the post-up configuration settings in the interfaces file, but it looks like those only pay attention to whether eth0 is enabled or not, and based on the link state.
I'm already using that with a Vyatta router VM in this same box. I've got an internal subnet setup within the ESXi box. The internal subnet is 172.24.99.xx, the external hardwired subnet is 172.24.222.xx, and the external wireless subnet is 172.24.221.xx. The Vyatta router VM controls the internal subnet and can route traffic from that subnet to the wireless external subnet. The other VMs in the box have access to the internal subnet and the hardwired external subnet.
What I wanted to be able to do, for testing purposes, is access the VMs in the box from a computer on the external hardwired subnet via the internal subnet. This works with a windows VM as long as the external hardwired subnet is disconnected (i.e. nic cable disconnected) and you don't actually have to mark the nic as disabled. However, with Linux it looks like you have to actually disable the eth0 interface (ifdown), rather than just use VMWare to simulate disconnecting the cable, in order to get the routing table to remove the default routes for that interface.
What that basically means is that if the external hardwired network fails I will have to use VMWare to login to the Ubuntu VM via the local console and manually disable eth0 with ifdown in order to get the backup connection to fully work. While I will be able to do that because the Vyatta VM will allow me to access the VMWare interface using the backup wireless network, it won't work without manual intervention, which is what I'm trying to avoid.
Sorry to say but, your scenario is not fully clear to me, guess with a network diagram it would be better understandable.
Anyway, maybe you need dynamic routing, something like OSPF. Then routing tables can be dynamically updated automatically. You can implement OSPF using zebra in linux, but all the connected router/machine need to support that. It's not only putting the interface down for the defaults route to go, but again you will need to bring the interface up again automatically when your primary link is up.
Well, I guess what it boils down to is the question of whether or not there is a way to have a script triggered when the link state of an ethernet connection changes. All the stuff I've found (e.g. pre-up, post-down, etc.) which are in /etc/network/interface only seems to be triggered when the interface itself, from a software perspective, is enabled or disabled (e.g. ifup, ifdown), and they don't appear to be triggered when just the link state changes, which seems a bit strange to me. If there is a way to trigger a script when just the link state changes then I can put the route commands I need in that script.