What I am trying to accomplish is extremely close to this, with one twist. I want the second "nic" to be a second ip address (I guess sometimes called a virtual nic), added to the same physical nic (on the same subnet, and able to get to the gateway if I specifically send a packet over this new nic). I know you will probably ask why the h*ll I need to do that, and as you might guess its a long, complicated answer, but the bottom line is I need:
- Two unique addresses that can get to the internet when I bind to them specifically
- Those interfaces be on the same subnet for ease of the remainder of the network config
If it helps, the second interface need only "behave" when I bind to it and send packets out of it (or packets specifically arrive to it). That is, I don't need any other routing rules than that.
Now, I tried the most obvious which is to modify the answer above just changing eth1 to eth0:1, however that did not work for me, resulting in RTNETLINK answers: File exists
and the virtual nic not actually functioning when I bound to it (for example, with a simple test of wget --bind-address
.
I feel like that solution is very close though, it just needs a little something more - please help!
/etc/network/interfaces
would look like on this setup? Here is my example of working alias interface.