Using multiple IP addresses at once
February 17th, 2013Ever needed to configure a network-based device using a web interface, but found that its default IP address doesn’t match the setup of your network? e.g. Your new device uses 192.168.1.* and you use 192.168.0.* ?
Here’s an easy way to fix it: set up your machine to talk to both subnets at once. Here’s a little screencast to show how it’s done on the Mac.
February 17th, 2013 at 8:55 pm
My mind is boggling over how to do that with ifconfig, or what ifconfig reports when you have done that – and does it scale to more subnets?
February 17th, 2013 at 11:38 pm
Hi Dan –
On Linux, you set up extra ‘aliases’ for the interface, called things like
eth0:0,eth0:1etc. And, yes, you can have lots of them. You can add them in /etc/network/interfaces, but to do it temporarily on the command line needs something like:and then
when you’ve finished.
Or, if you prefer the new ‘ip’ commands:
In many ways this is a lot like VLANs – there’s no problem in running multiple subnets at the same time on the same underlying network, be it wired or wireless. But the thing you need to remember is that nothing will forward packets between those subnets, or to the outside world, unless you take steps to make them do so.
So, for example, you can’t just add your 192.168.0.1 router as the way for things on the 192.168.1.* network to reach the outside world, because they don’t know how to talk to even that address, nor will it know how to talk back to them.
But this trick was very useful for me recently when someone had installed a device out of reach above a customer’s ceiling without setting its network correctly…
Q