LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2013, 12:04 AM   #1
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Rep: Reputation: Disabled
Add interface with no route


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?

Last edited by bitblit; 01-20-2013 at 12:05 AM.
 
Old 01-20-2013, 02:04 AM   #2
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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...

Kind regards,

Eric
 
1 members found this post helpful.
Old 01-20-2013, 07:41 AM   #3
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
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.

Last edited by bitblit; 01-20-2013 at 07:44 AM.
 
Old 01-20-2013, 08:15 AM   #4
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

It could help a lot if we know what application you are talking about. Sounds strange, an application you cannot configure the IP for... Could you shed some light?

Kind regards,

Eric
 
Old 01-20-2013, 08:17 AM   #5
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
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?
 
1 members found this post helpful.
Old 01-20-2013, 08:30 AM   #6
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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.

Kind regards,

Eric
 
Old 01-20-2013, 08:45 AM   #7
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-20-2013, 08:53 AM   #8
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hi,

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.

Kind regards,

Eric
 
Old 01-20-2013, 08:55 AM   #9
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
And yes, I could be wrong but if the network script calls ifconfig, it will add a route. Once I figure pure the correct commands, I'll write a network script that does not call ifconfig.
 
Old 01-20-2013, 09:07 AM   #10
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Quote:
Originally Posted by bitblit View Post
And yes, I could be wrong but if the network script calls ifconfig, it will add a route. Once I figure pure the correct commands, I'll write a network script that does not call ifconfig.
Hi,

To what script are you referring here? The OS one to configure an IP/alias (ifconfig / ip)?

Kind regards,

Eric
 
Old 01-20-2013, 09:20 AM   #11
bitblit
LQ Newbie
 
Registered: Feb 2012
Posts: 9

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-20-2013, 09:24 AM   #12
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297Reputation: 1297
Hello,

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.

Kind regards,

Eric
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
packet coming through one interface route out via another interface and SNAT also saiyen2002 Linux - Networking 2 09-14-2009 06:56 PM
route add with specific interface jonaskellens Linux - Networking 4 04-21-2009 12:51 AM
how to add static route for loopback interface. UltraSoul Linux - Software 4 04-12-2009 01:02 AM
noob: ip route add vs route add jCash Linux - Networking 1 07-19-2007 11:12 AM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:20 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration