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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
What is the best way to add an interface with an IP address but no route anywhere. When I add the interface with ifconfig, it automatically adds routing information.
I have a set of VirtualBox VMs with a host only adapter. The host is running instances of an application that will bind to those adapters. Each set of VM-host application will need to have the same IP addresses, so I do not want them to be able to route between each other, or any other interface. They do not need access to anything outside their isolated network. What is the best way to remove all their routing, or create them without routing?
One option to avoid any problems would be to use the local loopback interface in my opinion. You can easily add additional IP addresses to that one (127.0.1.1, 127.0.1.2, ...) and they would always route through the loopback interface, not interfering with your network. That is if your application can work with that...
They all need to have the same specific IP address. They all need to be 172.16.0.1. The Linux side program is very specific. Everything binds directly to the interface in promiscuous mode and each instance should only see other applications bound to that interface.
I just checked and the VirtualBox host-only interface is a loopback. I haven't checked yet, but I'm fairly sure that the loop back creation includes an entry in the routing table so I would have to remove it.
I think a better option is to create a TAP with tunctl, give it an IP address without an entry in the routing table, then use bridged networking in VirtualBox. My question, though, is how do I give it an IP address without the routing table entry? ifconfig does it automatically. Or do I have to use ifconfig and then just delete the route?
I think you're only option would be to manually (or via script) delete the route information you don't want. Just take into account that, in my opinion, the routing information gets recreated when you restart network service / virtual machine. But I'm not sure about that.
It's basically a custom virtual machine that allows me to run the actual firmware for that hardware. Sort of like QEMU. Changing the IP address would make it different than the actual hardware it simulates, which would require me to recompile the firmware, which defeats the purpose. I wrote some code that serves as a proxy for my emulator, making it a little easier to debug but I can only run a single instance at a time. When I try creating another instance, it adds an identical interface with ifconfig, which creates an identical route, confusing everything.
I thought ifconfig just ran a suite of other commands. If I knew what those other lower level commands were, I could script those commands and remove the command to add the route.
Now you lost me completely. What does an IP have to do with hardware? If a hardware device can understand TCP/IP and have an IP configured then I would assume that which IP you configure on it does not matter nor affect the acting or functionality of the hardware in question. An IP address as I understand it is just a configuration parameter so how would the IP address configured change the behavior of a hardware device other then the connectivity to other networks? If you want to look at the source code for ifconfig, I'm sure that can be found on the internet.
My emulator emulates an industrial firmware controller, not at all Linux or Windows based OS. Unless you're an embedded software engineer, it would look completely foreign to you. It is configured with an IP address that is specifically selected. This is just one piece of a much larger system with static IPs, not dynamic. Furthermore, I did not write the network code. Somebody else did and I do not have access to that source code. So even if I wanted to change it, I couldn't. Not that I would want to anyway. Changing the IP would require me to make changes throughout the entire system to allow everything to still communicate. Unlike a Linux server or consumer electronics device like a network router, industrial firmware controllers like this are not easily configurable, by design.
My emulator allows me to test and inject failures which would otherwise be very difficult or impossible to do on the hardware. Normally, each engineer has everything installed local to their PC and they're normally happy with being limited to only one instance of the emulator. We now have a reason to also offer centrally managed deployments on a Linux server. But, this would require multiple instances of the emulator. Each emulator binds to a separate interface. We've been using TAPs with OpenVPN giving then remote access directly to the emulated firmware controller. Like I said before, the firmware that it emulates has a static IP. I could either just remove the route for each interface, or I could tweak code and recompile a bunch of other firmware controllers. Not only is this a nontrivial piece of work, but this could also be used for testing. It defeats the purpose if what we test is different than what we field. Ideally, what is tested is identical to what is fielded.
Yes, this is probably a nonstandard configuration, but I'm not writing web servers or email clients. I'm using my Linux server to develop very low level firmware controllers.
I think the easiest thing to do is just add the command to delete the route to the network scripts.
Thank you very much for the detailed description. It sort of makes it a lot clearer for me. Unfortunately, the only thing I could tell you is to delete the routing information after the IP is configured. Best of luck.